Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carlos-rian/guvicorn_logger
https://github.com/carlos-rian/guvicorn_logger
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/carlos-rian/guvicorn_logger
- Owner: carlos-rian
- Created: 2022-03-04T19:24:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T12:13:28.000Z (5 months ago)
- Last Synced: 2024-10-13T07:25:06.005Z (about 1 month ago)
- Language: Python
- Size: 313 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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
```python
from guvicorn_logger import Loggerlogger = Logger().configure()
```#### Example
```python
logger.info("Message - Info")
logger.error("Message - Error")
logger.warning("Message - Warning")
logger.critical("Message - Critical")
```
#### Output- Framework (Uvicorn, Gunicorn, Fastapi)
![alt text](https://raw.githubusercontent.com/carlos-rian/guvicorn_logger/main/docs/img/framework-web.JPG)### FastAPI | asgi-correlation-id
```python
from asgi_correlation_id import CorrelationIdMiddleware
from fastapi import FastAPIfrom 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](https://raw.githubusercontent.com/carlos-rian/guvicorn_logger/main/docs/img/fastapi.png)