Skip to content

carlos-rian/guvicorn_logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages