Using python 3.8, I'd like to use logging
, and record with different formats according to level
.
With logging.DEBUG
, my output format would be "%(asctime)s %(filename)s, line %(lineno)d : %(name)s %(levelname)s %(message)s"
, and above this level, it would be "%(asctime)s %(levelname)s %(message)s"
.
logger.debug("debug message")
logger.info("info message")
I've browsed through the doc. with LoggerAdapter, ContextFilter, ... I could not find any solution. Any idea ?