https://github.com/ftnext/happy-python-logging.git
Make practical Python logging easy.
pip install happy-python-logging
getLoggerForLibrary()happy_python_logging.getLoggerForLibrary()
-import logging
+from happy_python_logging import getLoggerForLibrary
-logger = logging.getLogger(__name__)
-logger.addHandler(logging.NullHandler())
+logger = getLoggerForLibrary(__name__)
See example for detail.
OrFilterhappy_python_logging.lib.filters.OrFilter
import logging
from happy_python_logging.lib.filters import OrFilter
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)
stream_handler = logging.StreamHandler()
stream_handler.addFilter(OrFilter("libA", "libB"))
root_logger.addHandler(stream_handler)
DEBUG | libA:libA_awesome:8 - awesome
DEBUG | libB:libB_fabulous:12 - fabulous
happy-python-logging is distributed under the terms of the MIT license.