Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

py-fastapi-logging

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

py-fastapi-logging

FastAPI Logging

  • 0.5.1
  • PyPI
  • Socket score

Maintainers
3

py-fastapi-logging

ENV-переменные для управления логами

Уровень логов. debug - для площадок отладки, info - для PROM

LOG_LEVEL=info

Формат логов: SIMPLE (обычный) или JSON (JSON-STDOUT - лог в формате json в поток stdout)

LOG_FORMAT=SIMPLE

Папка, в которой будут лежать логи

LOG_DIR=/var/log/

Название файла лога

LOG_FILENAME=production.log

Добавление переменных в лог (JSON-формат) из переменных окружения

LOG_ENV_EXTRA="field1:ENV_VAR_NAME_1,field2:ENV_VAR_NAME_2"

Интеграция в FastAPI приложение

from fastapi import FastAPI
from py_fastapi_logging.middlewares.logging import LoggingMiddleware
app = FastAPI()
app.add_middleware(LoggingMiddleware, app_name='my_app_name')

Использование логгера в приложениях не на FastAPI

import logging
from py_fastapi_logging.config.config import init_logger
init_logger(app_name='my_app_name')
logger = logging.getLogger()

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc