Hi,
I'd like to have loglevel TRACE (5) for my application as I don't think that debug()
is enought. Additionally log(5, msg)
isn't what I want.
The question is, how can I add a custom log level to a Python logger?
Actually I've a mylogger.py with the following content:
import logging
@property
def log(obj):
myLogger = logging.getLogger(obj.__class__.__name__)
return myLogger
In my code I use it in the following way:
class ExampleClass(object):
from mylogger import log
def __init__(self):
'''The constructor with the logger'''
self.log.debug("Init runs")
Now I'd like to call self.log.trace("foo bar")
Thanks in advance for your help.