Commit fed01ded authored by ssrq's avatar ssrq

[cdist.log] Define custom log functions on logging.Logger

Define out custom logger functions on logging.Logger so that they are passed on
to all other loggers.

Also, the logger functions need to take a self argument so that they can log on
the corrent Logger.
parent f730aa76
Pipeline #4008 passed with stage
in 2 minutes and 20 seconds
......@@ -36,25 +36,27 @@ import threading
logging.OFF = logging.CRITICAL + 10 # disable logging
logging.addLevelName(logging.OFF, 'OFF')
logging.VERBOSE = logging.INFO - 5
logging.addLevelName(logging.VERBOSE, 'VERBOSE')
def _verbose(msg, *args, **kwargs):
logging.log(logging.VERBOSE, msg, *args, **kwargs)
def _verbose(self, msg, *args, **kwargs):
self.log(logging.VERBOSE, msg, args, **kwargs)
logging.Logger.verbose = _verbose
logging.verbose = _verbose
logging.TRACE = logging.DEBUG - 5
logging.addLevelName(logging.TRACE, 'TRACE')
def _trace(msg, *args, **kwargs):
logging.log(logging.TRACE, msg, *args, **kwargs)
def _trace(self, msg, *args, **kwargs):
self.log(logging.TRACE, msg, *args, **kwargs)
logging.trace = _trace
logging.Logger.trace = _trace
class CdistFormatter(logging.Formatter):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment