Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/12345k/fastapi_logging
Repo focused to monitor and log each and every request with dashboard
https://github.com/12345k/fastapi_logging
fastapi fastapi-admin fastapi-logging logger-middleware logging logging-library monitoring monitoring-plugins python3
Last synced: 2 months ago
JSON representation
Repo focused to monitor and log each and every request with dashboard
- Host: GitHub
- URL: https://github.com/12345k/fastapi_logging
- Owner: 12345k
- License: mit
- Created: 2021-04-01T13:49:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-12T07:04:48.000Z (over 3 years ago)
- Last Synced: 2024-09-29T02:21:44.861Z (3 months ago)
- Topics: fastapi, fastapi-admin, fastapi-logging, logger-middleware, logging, logging-library, monitoring, monitoring-plugins, python3
- Language: Python
- Homepage: https://pypi.org/project/fastapi-route-log/
- Size: 37.1 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Fastapi Route Log
A FastAPI router for logging every request.
# Installation
```buildoutcfg
$ pip install fastapi_route_log
```
# Dashboard testing```python
cd fastapi_route_log
uvicorn dev.main:app --reload
```
check the url: http://localhost:8000/fastapi_dashboard# Code Sample
```python
from fastapi_route_log.log_request import LoggingRouteapp = FastAPI()
app.router.route_class = LoggingRoute
```
# Example/Test```python
uvicorn example.main:app --reload
```# Output
```json
{
"type": "request",
"uuid": "29da7a45-e673-4b15-94bf-3e51737de6b3",
"env": null,
"region": null,
"name": null,
"method": "POST",
"useragent": {
"family": "insomnia",
"major": 2020,
"minor": 5,
"patch": "2020.5.0",
"device": {
"family": "Other",
"brand": null,
"model": null,
"major": "0",
"minor": "0",
"patch": "0"
},
"os": {
"family": "Other",
"major": 0,
"minor": 0,
"patch": ""
}
},
"url": "/hello_world",
"query": {
"get": [
"hello"
]
},
"body": {
"rawMaterialName": "TC-407",
"manufacturerName": "Tokuriki Honten Co., Ltd.",
"name": "karthicks"
},
"length": null,
"ts": "2021-04-01 18:48:19"
}
{
"type": "metrics",
"uuid": "29da7a45-e673-4b15-94bf-3e51737de6b3",
"env": null,
"region": null,
"name": null,
"method": "POST",
"status_code": 200,
"url": "/hello_world",
"query": {
"get": [
"hello"
]
},
"length": "113",
"latency": "0.26",
"ts": "2021-04-01 18:48:19"
}
INFO: 127.0.0.1:45872 - "POST /hello_world?get=hello HTTP/1.1" 200 OK```