GithubHelp home page GithubHelp logo

12345k / fastapi_logging Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 2.0 38 KB

Repo focused to monitor and log each and every request with dashboard

Home Page: https://pypi.org/project/fastapi-route-log/

License: MIT License

Python 65.39% HTML 34.61%
fastapi fastapi-logging fastapi-admin python3 logging logger-middleware logging-library monitoring monitoring-plugins

fastapi_logging's Introduction

Fastapi Route Log

Package version License

A FastAPI router for logging every request.

Installation

$ pip install fastapi_route_log

Dashboard testing

cd fastapi_route_log
uvicorn dev.main:app --reload

check the url: http://localhost:8000/fastapi_dashboard

Code Sample

from fastapi_route_log.log_request import LoggingRoute

app = FastAPI()
app.router.route_class = LoggingRoute

Example/Test

uvicorn example.main:app --reload

Output

{
    "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

fastapi_logging's People

Contributors

karthick-optisol avatar vpkprasanna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fastapi_logging's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.