Skip to main content

Code to integrate Loguru with Python's standard logging module

Project description

Loguru Logging Intercept

PyPI - Version PyPI - Downloads

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

loguru_logging_intercept-0.1.5.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loguru_logging_intercept-0.1.5-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file loguru_logging_intercept-0.1.5.tar.gz.

File metadata

File hashes

Hashes for loguru_logging_intercept-0.1.5.tar.gz
Algorithm Hash digest
SHA256 581038bf1310fbb06cda48afbd373e72bbc01d51c4df058f49081ab7a7c5f984
MD5 54f816b3beb470dbe3a15797316c07e2
BLAKE2b-256 329d12d76dfcac97943d439d760acb960d423e0f2b66530d2038374c9f192afa

See more details on using hashes here.

File details

Details for the file loguru_logging_intercept-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for loguru_logging_intercept-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d0e0397fe83e4f1122cbd37bf5d73f8c878099b6fb52a236d5123654f46fc0c5
MD5 a711ce5134f778fd629e4cd2644efec5
BLAKE2b-256 f6ee78df4f27c14490613886d0a03959f363002cb76378266987805d92adac91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page