I've been trying to add a custom log level by following these two excellent posts:
How to add a custom loglevel to Python's logging facility
In my top level __init__.py I've put:
import logging
logging.VERBOSE = 15
logging.addLevelName(logging.VERBOSE, "VERBOSE")
def verbose(self, message, *args, **kws):
if self.isEnabledFor(logging.VERBOSE):
# Yes, logger takes its '*args' as 'args'.
self._log(logging.VERBOSE, message, args, **kws)
setattr(logging, 'verbose', verbose)
setattr(logging.Logger, 'verbose',verbose)
#also tried
# logging.Logger.verbose=verbose
# logging.verbose=verbose
logging.getLogger(__name__).addHandler(logging.NullHandler())
In the various other class and sub-modules, I'm expecting that I can then:
import logging
.
.
.
logging.verbose("Someone sent us up the bomb")
But, all that gets me is:
TypeError: verbose() missing 1 required positional argument: 'message'
If I switch to:
logging.log(logging.VERBOSE, "Intent Returned: " + intent_name)
I don't get an exception thrown, but I don't get any message printed either.