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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loguru_logging_intercept-0.1.5.tar.gz.
File metadata
- Download URL: loguru_logging_intercept-0.1.5.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
581038bf1310fbb06cda48afbd373e72bbc01d51c4df058f49081ab7a7c5f984
|
|
| MD5 |
54f816b3beb470dbe3a15797316c07e2
|
|
| BLAKE2b-256 |
329d12d76dfcac97943d439d760acb960d423e0f2b66530d2038374c9f192afa
|
File details
Details for the file loguru_logging_intercept-0.1.5-py3-none-any.whl.
File metadata
- Download URL: loguru_logging_intercept-0.1.5-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0e0397fe83e4f1122cbd37bf5d73f8c878099b6fb52a236d5123654f46fc0c5
|
|
| MD5 |
a711ce5134f778fd629e4cd2644efec5
|
|
| BLAKE2b-256 |
f6ee78df4f27c14490613886d0a03959f363002cb76378266987805d92adac91
|