From b747c46a1753c96841936bed7f9f428d84cca4ac Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:39:45 +0200 Subject: [PATCH] less spammy logs in prd --- src/core/logging_config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/logging_config.py b/src/core/logging_config.py index ac479205..1a731990 100644 --- a/src/core/logging_config.py +++ b/src/core/logging_config.py @@ -2,7 +2,7 @@ import logging import sys import warnings - +from .config import settings # # log formatting formatter = logging.Formatter( json.dumps( @@ -30,10 +30,11 @@ logging.getLogger("aiomysql").setLevel(logging.ERROR) logging.getLogger("aiokafka").setLevel(logging.WARNING) -# uvicorn_error = logging.getLogger("uvicorn.error") -# uvicorn_error.disabled = True -# uvicorn_access = logging.getLogger("uvicorn.access") -# uvicorn_access.disabled = True +if settings.ENV == "PRD": + uvicorn_error = logging.getLogger("uvicorn.error") + uvicorn_error.disabled = True + uvicorn_access = logging.getLogger("uvicorn.access") + uvicorn_access.disabled = True # https://github.com/aio-libs/aiomysql/issues/103 # https://github.com/coleifer/peewee/issues/2229