Ejemplo n.º 1
0
import signal
import sys
import threading
import traceback

from versile.internal import _vexport

__all__ = [
    'debug_to_console', 'debug_to_file', 'debug_to_watcher',
    'disable_debugging', 'critical', 'warn', 'error', 'info', 'debug',
    'ldebug', 'log_thread', 'log_lock', 'console', 'stack_all', 'print_trace',
    'debug_trace', 'print_etrace', 'debug_etrace', 'sigusr1', 'LOG_LVL_THREAD',
    'LOG_LVL_LOCK', 'DEBUG', 'WARN', 'CRITICAL', 'ERROR', 'LDEBUG',
    'DEBUG_TRACE', 'DEBUG_ETRACE'
]
__all__ = _vexport(__all__)
"""Custom log level for thread-operation level logging"""
LOG_LVL_THREAD = 8
"""Custom log level for lock-level logging"""
LOG_LVL_LOCK = 6

logging.addLevelName(LOG_LVL_THREAD, 'THREAD')
logging.addLevelName(LOG_LVL_LOCK, 'LOCK')
"""Debug Logger."""
debug_log = None
__debug_lock = threading.RLock()


def debug_to_console(lvl=None, formatter=None):
    """Add debug logging to the console.
Ejemplo n.º 2
0
 def __init__(self, builtins=True):
     self.__namespace = dict()
     if builtins:
         _b_str = _vexport(['__builtins__'])[0]
         self.__namespace[_b_str] = globals()[_b_str]