Skip to main content

Python Logging Interceptor

Capture Python's stdlib logging messages and route them to other logging frameworks.

(Modified and packaged for PyPI from Matthew Scholefield's loguru-logging-intercept.)

Currently supported targets:

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 code for setting 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_interceptor() as shown below:

from logging_interceptor import setup_loguru_interceptor


setup_loguru_interceptor(modules=("foo", "foo.bar", "foo.baz"))

# now call functions from `foo` that use getLogger(__name__)

Installation

Install via pip:

pip3 install logging-interceptor

Metadata

Release files for logging-interceptor 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logging-interceptor 0.1.2
File Size Uploaded
logging_interceptor-0.1.2.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for logging-interceptor 0.1.2
File Interpreter ABI Platform
logging_interceptor-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.7 kB

Release files / logging_interceptor-0.1.2.tar.gz

Download URL logging_interceptor-0.1.2.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e2186a8418ae84d922e2a57e0bb48bfd2f9737e897f784dbb7eab8808fbe0a85
BLAKE2b-256 checksum
How to use checksums
f581493ae002928054cb075d0e16aede958b726a58e7f5c7f4144e03583a533f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.4 Linux/5.15.0-74-generic

Release files / logging_interceptor-0.1.2-py3-none-any.whl

Download URL logging_interceptor-0.1.2-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd1e1cf9e81f457427bab08f0816e1cb06e5a427667006c7aa7a0b15f11afa24
BLAKE2b-256 checksum
How to use checksums
2f592aca8986184705bcb689a7c93d7985c499ccddb7973d31e046d601111916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.4 Linux/5.15.0-74-generic
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page