Skip to main content

Colored, normalizes and joins logs between Uvicorn and Gunicorn.

Project description

Guvicorn_logger

This lib colored, normalizes and joins logs between Uvicorn and Gunicorn. There is a common problem when using Uvicorn for Dev and Gunicorn for Prod, normally the logs generated by Uvicorn wokers are not captured by Gunicorn.

This lib facilitates this configuration...

Easy config

from guvicorn_logger import Logger

logger = Logger().configure()

Example

logger.info("Message - Info")
logger.error("Message - Error")
logger.warning("Message - Warning")
logger.critical("Message - Critical")

Output

  • Framework (Uvicorn, Gunicorn, Fastapi) alt text

FastAPI | asgi-correlation-id

from asgi_correlation_id import CorrelationIdMiddleware
from fastapi import FastAPI

from guvicorn_logger import Logger

app = FastAPI()


app.add_middleware(CorrelationIdMiddleware)


logger = Logger(correlation_id=True).configure()


@app.get("/")
def main():
    logger.info("Message - Info")
    logger.error("Message - Error")
    logger.warning("Message - Warning")
    logger.critical("Message - Critical")

Output

alt text

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

guvicorn_logger-0.1.16.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

guvicorn_logger-0.1.16-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

Supported by

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