import sys
def info(type, value, tb):
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
sys.__excepthook__(type, value, tb)
else:
import traceback, pdb
traceback.print_exception(type, value, tb)
print
pdb.post_mortem(tb)
sys.excepthook = info
import logging
FORMAT = '%(asctime)-15s %(filename)s:%(lineno)d\t%(funcName)s %(message)s'
logging.basicConfig(format=FORMAT, level=logging.INFO)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.debug("CheckDebug")
logger.info("CheckInfo")