Code to integrate Loguru with Python's standard logging module
Project description
Loguru Logging Intercept
Code to integrate Loguru with Python's standard logging module
Loguru is a great alternative logging library for
Python. However, if you use (potentially external) code that already integrates with
Python's default logger, you'll get a combination of the two logging styles. This code
provides a function that sets up an intercept handler to route calls to Python's
default logging
module to Loguru.
Usage
Before calls that use Python's default logging
module, call the provided
setup_loguru_logging_intercept()
as shown below:
import logging
from loguru_logging_intercept import setup_loguru_logging_intercept
def main():
setup_loguru_logging_intercept(
level=logging.DEBUG,
modules=("foo", "foo.bar", "foo.baz")
)
# Can now call functions from foo that use getLogger(__name__)
...
Installation
Install via pip
:
pip3 install loguru-logging-intercept
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for loguru-logging-intercept-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3913c1a97b5074ca8ad2fea7fa50456cb50f476484a42a6f8fcc362a50630064 |
|
MD5 | 716c24d631ebb8dd93f6eb0bbd201d8c |
|
BLAKE2b-256 | e66ee7f6f4bf0cc6bf5335106bee2326605f44527000b5998c06e94ebf774d81 |