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
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 uvicorn_loguru_integration-0.3.2.tar.gz.
File metadata
- Download URL: uvicorn_loguru_integration-0.3.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d3bc4f0a9c817ff29f95a04100762f967c37415717eb8f5e27025649ee34c76
|
|
| MD5 |
43395717a3758c9b1c80e66f0265752c
|
|
| BLAKE2b-256 |
409d8ee02f74eb7b6ad2d2e80d521d10edd87f98e06e79deb353715655b685ac
|
File details
Details for the file uvicorn_loguru_integration-0.3.2-py3-none-any.whl.
File metadata
- Download URL: uvicorn_loguru_integration-0.3.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5192fe3026b71bc11a93ebe9d709323f9f57122dddc2a49cab9858df165773b4
|
|
| MD5 |
fe573dba916bcb0a6271bd8ead7c0999
|
|
| BLAKE2b-256 |
c039dc3ad430ab037da324a8bafd72cd538be1b2760daaa4d53359d857bb5457
|