{"repo":"redb0/fastapi-logger","free":true,"listed":false,"github":"https://github.com/redb0/fastapi-logger","clone":"git clone https://github.com/redb0/fastapi-logger.git","description":"Structured logs and middleware for fastapi with sentry integration","language":"Python","stars":26,"topics":["fastapi","logging","python","sentry","structlog"],"license":"MIT","category":"analytics","readme_excerpt":"FastAPI structured logs Provides a wrapper over the structlog for additional doping in json format, as well as output of standard logs to the console, configuration via .env files via pedantic. In addition, middleware and a sentry configuration are available for use in FastAPI applications. Installation You can use pip : or poetry : Using logging To implement logging in an application, two things are necessary: define the configuration and use setup logger : In this case, the entire configuration is determined manually by creating an instance of LogSettings . If you want to get the configuration from the environment variables, then add LogSettings as a nested model in your settings: In this case, the entire configuration is taken from the .env file by means of Pedantic. To use the library in the minimum version, see example №1 ( docs src/example 1.py ). Logger configuration The logger configuration is implemented using the pydantic model LogSettings . You can easily integrate it into your application settings model. Logger configuration parameters: - Name of the logger ( LOGGER ), default default - Logging level ( LOG LEVEL ), default INFO - Flag that activates logging in json format ( JSON LOGS ), default True - Logging of the traceback in string form ( TRACEBACK AS STR ), default True - The name of the file ( FILENAME ), default None - The interval of writing to the file ( WHEN ), one of the S , M , H , D , W , default D (see TimedRotatingFileHandler) - The number of saved ","default_branch":null,"files":null,"tree":[],"storefront":"/r/redb0","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/redb0/fastapi-logger/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}