Move logging and exceptions out of server/base.py