Skip to main content

Code to integrate uvicorn.run with Loguru logging

Project description

Uvicorn Loguru Integration

Code to integrate uvicorn.run with Loguru logging

Loguru is a great alternative logging library for Python. However, since Uvicorn uses Python's standard logging library, using Loguru looks inconsistent. This module injects an intercept handler in the correct location after initializing Uvicorn so that all logs get routed through Loguru.

Usage

Call run_uvicorn_loguru with an instance of uvicorn.Config:

from uvicorn_loguru_integration import run_uvicorn_loguru


def main():
    run_uvicorn_loguru(
        uvicorn.Config(
            "myapp:app",
            host="0.0.0.0",
            port=8000,
            log_level="info",
            reload=True,
        )
    )


if __name__ == "__main__":
    main()

Installation

Install via pip or uv:

pip3 install uvicorn-loguru-integration
# or
uv pip install uvicorn-loguru-integration

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

uvicorn_loguru_integration-0.3.3.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

uvicorn_loguru_integration-0.3.3-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file uvicorn_loguru_integration-0.3.3.tar.gz.

File metadata

  • Download URL: uvicorn_loguru_integration-0.3.3.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for uvicorn_loguru_integration-0.3.3.tar.gz
Algorithm Hash digest
SHA256 d030477a10bdade254035b0c667fdade8bbf6e1aa86ae686c8763ff44e36f3d1
MD5 1fddc0c8507e7f20c7eeaea16f94e8f5
BLAKE2b-256 a4ccb4fe5c5660095b39008cf7be37db90bcaedd07aad2ea5433f2bf8c5eae56

See more details on using hashes here.

File details

Details for the file uvicorn_loguru_integration-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: uvicorn_loguru_integration-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for uvicorn_loguru_integration-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4088b692ed677be965c91c9e6c33f8a8ee9cae9b3ddb15335d1f23ff9f33db75
MD5 32e31f18b88f3ce13e02ece74dbf99a4
BLAKE2b-256 54355439ca2462521076fc9737a04d46509ba88d2da8e5edc1748a6c6754f082

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