# Logger's ctor uses _log_level directly. _observer = None # for Twisted legacy logging support; see below _loggers = weakref.WeakSet() # weak-references of each logger we've created _log_level = 'info' # global log level; possibly changed in start_logging() _started_logging = False _categories = {} IFailedFuture.register(Failure) _NEW_LOGGER = False try: # Twisted 15+ from twisted.logger import Logger as _Logger, formatEvent, ILogObserver from twisted.logger import globalLogBeginner, formatTime, LogLevel ILogger.register(_Logger) _NEW_LOGGER = True except ImportError: # we still support Twisted 12 and 13, which doesn't have new-logger from zope.interface import Interface from datetime import datetime import time # provide our own simple versions of what Twisted new-logger does class ILogObserver(Interface): pass def formatTime(t): # noqa dt = datetime.fromtimestamp(t)
# contains weakrefs; we add _TxLogger instances to this *until* such # time as start_logging is called (with the desired log-level) and # then we call _set_log_level on each instance. After that, # _TxLogger's ctor uses _log_level directly. _observer = None # for Twisted legacy logging support; see below _loggers = [] # list of weak-references of each logger we've created _log_level = 'info' # global log level; possibly changed in start_logging() IFailedFuture.register(Failure) _NEW_LOGGER = False try: # Twisted 15+ from twisted.logger import Logger, formatEvent, ILogObserver from twisted.logger import globalLogBeginner, formatTime, LogLevel ILogger.register(Logger) _NEW_LOGGER = True except ImportError: # we still support Twisted 12 and 13, which doesn't have new-logger from functools import partial from zope.interface import Interface from datetime import datetime import time # provide our own simple versions of what Twisted new-logger does class ILogObserver(Interface): pass
# Logger's ctor uses _log_level directly. _observer = None # for Twisted legacy logging support; see below _loggers = weakref.WeakSet() # weak-references of each logger we've created _log_level = 'info' # global log level; possibly changed in start_logging() _started_logging = False _categories = {} IFailedFuture.register(Failure) _NEW_LOGGER = False try: # Twisted 15+ from twisted.logger import Logger as _Logger, formatEvent, ILogObserver from twisted.logger import globalLogBeginner, formatTime, LogLevel ILogger.register(_Logger) _NEW_LOGGER = True except ImportError: # we still support Twisted 12 and 13, which doesn't have new-logger from zope.interface import Interface from datetime import datetime import time # provide our own simple versions of what Twisted new-logger does class ILogObserver(Interface): pass def formatTime(t): # noqa
# contains weakrefs; we add _TxLogger instances to this *until* such # time as start_logging is called (with the desired log-level) and # then we call _set_log_level on each instance. After that, # _TxLogger's ctor uses _log_level directly. _observer = None # for Twisted legacy logging support; see below _loggers = [] # list of weak-references of each logger we've created _log_level = 'info' # global log level; possibly changed in start_logging() IFailedFuture.register(Failure) _NEW_LOGGER = False try: # Twisted 15+ from twisted.logger import Logger, formatEvent, ILogObserver from twisted.logger import globalLogBeginner, formatTime, LogLevel ILogger.register(Logger) _NEW_LOGGER = True except ImportError: # we still support Twisted 12 and 13, which doesn't have new-logger from functools import partial from zope.interface import Interface from datetime import datetime import time # provide our own simple versions of what Twisted new-logger does class ILogObserver(Interface): pass def formatTime(t):