I\'d like to have loglevel TRACE (5) for my application, as I don\'t think that debug()
is sufficient. Additionally log(5, msg)
isn\'t what I want.
I took the avoid seeing "lambda" answer and had to modify where the log_at_my_log_level
was being added. I too saw the problem that Paul did – I don't think this works. Don't you need logger as the first arg in log_at_my_log_level
? This worked for me
import logging
DEBUG_LEVELV_NUM = 9
logging.addLevelName(DEBUG_LEVELV_NUM, "DEBUGV")
def debugv(self, message, *args, **kws):
# Yes, logger takes its '*args' as 'args'.
self._log(DEBUG_LEVELV_NUM, message, args, **kws)
logging.Logger.debugv = debugv