def boom(type, value, tb): from io import StringIO from app.util import io_helper import traceback with StringIO() as io: traceback.print_exception(type, value, tb, file=io) exc = io_helper.read_all(io) self.callback_exception(exc)
def extract_err(): err = io_helper.read_all(Log.io_err, '') return err
def extract_log(): with Log.lock_log: log = io_helper.read_all(Log.io_log, '') return log