Skip to content

Commit

Permalink
Merge pull request #482 from LACMTA:dev
Browse files Browse the repository at this point in the history
Refactor log level to ERROR for Logzio handlers
  • Loading branch information
albertkun authored Feb 12, 2024
2 parents 430fcf9 + 3542d63 commit e4b24f8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fastapi/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,16 +1018,17 @@ def setup_logging():
uvicorn_error_logger = logging.getLogger("uvicorn.error")
logger = logging.getLogger("uvicorn.app")
logzio_formatter = logging.Formatter("%(message)s")

logzio_uvicorn_access_handler = LogzioHandler(Config.LOGZIO_TOKEN, 'uvicorn.access', 5, Config.LOGZIO_URL)
logzio_uvicorn_access_handler.setLevel(logging.WARNING)
logzio_uvicorn_access_handler.setLevel(logging.ERROR) # Set level to ERROR
logzio_uvicorn_access_handler.setFormatter(logzio_formatter)

logzio_uvicorn_error_handler = LogzioHandler(Config.LOGZIO_TOKEN, 'uvicorn.error', 5, Config.LOGZIO_URL)
logzio_uvicorn_error_handler.setLevel(logging.WARNING)
logzio_uvicorn_error_handler.setLevel(logging.ERROR) # Set level to ERROR
logzio_uvicorn_error_handler.setFormatter(logzio_formatter)

logzio_app_handler = LogzioHandler(Config.LOGZIO_TOKEN, 'fastapi.app', 5, Config.LOGZIO_URL)
logzio_app_handler.setLevel(logging.WARNING)
logzio_app_handler.setLevel(logging.ERROR) # Set level to ERROR
logzio_app_handler.setFormatter(logzio_formatter)

uvicorn_access_logger.addHandler(logzio_uvicorn_access_handler)
Expand Down

0 comments on commit e4b24f8

Please sign in to comment.