def init(level=None, path=None): logging.captureWarnings(True) numLevel = parseLevel(level) for handler in logging.root.handlers[:]: logging.root.removeHandler(handler) logging.basicConfig( format= '%(asctime)s.%(msecs)03i: %(threadName)12.12s: %(levelname)8.8s: %(name)26s: %(message)s', datefmt='%H:%M:%S', level=numLevel, filename=path) def excepthook(type, exc, tb): logging.getLogger('RUNTIME').critical("Unhandled exception", exc_info=(type, exc, tb)) sys.__excepthook__(type, exc, tb) sys.excepthook = excepthook setup_thread_excepthook() def print_log(level, m, msg): logging.getLogger(m).log(level, msg.strip().replace('\n', '; ')) gizmo.setLoggerCallback(print_log) gizmo.setDebugLevel(numLevel)
def init(level=None, path=None): logging.basicConfig( format= '%(asctime)s:%(threadName)12.12s:%(levelname)8.8s:%(name)24.24s: %(message)s', level=level, filename=path) def print_log(level, m, msg): logging.getLogger(m).log(level, msg.strip().replace('\n', '; ')) gizmo.setLoggerCallback(print_log) gizmo.setDebugLevel(level)
def init(level=None, path=None): logging.captureWarnings(True) numLevel = parseLevel(level) for handler in logging.root.handlers[:]: logging.root.removeHandler(handler) logging.basicConfig( format= '%(asctime)s.%(msecs)03i:%(threadName)12.12s:%(levelname)8.8s:%(name)24.24s: %(message)s', datefmt='%H:%M:%S', level=numLevel, filename=path) def print_log(level, m, msg): logging.getLogger(m).log(level, msg.strip().replace('\n', '; ')) gizmo.setLoggerCallback(print_log) gizmo.setDebugLevel(numLevel)
def terminate(): gizmo.setLoggerCallback(None)