๐Ÿ“ฆ ftnext / happy-python-logging

โ˜… 2 stars โ‘‚ 0 forks ๐Ÿ‘ 2 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/ftnext/happy-python-logging.git
HTTPS git clone https://github.com/ftnext/happy-python-logging.git
SSH git clone git@github.com:ftnext/happy-python-logging.git
CLI gh repo clone ftnext/happy-python-logging
ftnext ftnext [test] exception() and log() also calls basicConfig() b6992ac 1 months ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ example
๐Ÿ“ src
๐Ÿ“ tests
๐Ÿ“„ .gitignore
๐Ÿ“„ AGENTS.md
๐Ÿ“„ LICENSE
๐Ÿ“„ pyproject.toml
๐Ÿ“„ README.md
๐Ÿ“„ README.md

happy-python-logging

Make practical Python logging easy.

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install happy-python-logging

Usage

For library developers

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.

OrFilter

happy_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

License

happy-python-logging is distributed under the terms of the MIT license.