Adopt structlog for better context awareness and debugging.
After import the logger for example from logging_config import logger, you could use the logger as a standard logger with additional context for example:
logger.info("Sample is loaded", name=self.sample.name, path=self.sample.path)
This would be efficient for debugging especially with Splunk.
Remove duplicate code especially for setup_logger, remove logger from __getstate__ and re-set the logger in __setstate__.
Remove debugv from the code base.
Replace warn with warning as warn is deprecated.
Things remain unchanged:
Logging settings such as logging level, logger name, logging file name etc.
2.Multiprocess logging logic. I keep this part logic unchanged until a better solution to avoid performance issue etc.
This is a large PR. Main changes are:
Adopt
structlog
for better context awareness and debugging. After import thelogger
for examplefrom logging_config import logger
, you could use the logger as a standard logger with additional context for example:Result log msg should be:
This would be efficient for debugging especially with Splunk.
Remove duplicate code especially for setup_logger, remove logger from
__getstate__
and re-set the logger in__setstate__
.Remove
debugv
from the code base.Replace
warn
withwarning
aswarn
is deprecated.Things remain unchanged:
logger
.