logging improvements (#2073)

* Scheduled tasks log to Debug, not Info

* Add LOG_LEVEL config to .env

* Update some other log levels and fix typos

* fix logger initializer

---------

Co-authored-by: Jakob Rubin <647846+Grygon@users.noreply.github.com>
This commit is contained in:
Hayden
2023-01-28 16:54:44 -09:00
committed by GitHub
parent 9ddb27b2e3
commit 530f7c9d6b
13 changed files with 28 additions and 24 deletions

View File

@@ -27,6 +27,8 @@ class LoggerConfig:
def get_logger_config():
settings = get_app_settings()
log_level = logging._nameToLevel[settings.LOG_LEVEL]
if not settings.PRODUCTION:
from rich.logging import RichHandler
@@ -35,6 +37,7 @@ def get_logger_config():
format=None,
date_format=None,
logger_file=None,
level=log_level,
)
output_file_handler = logging.FileHandler(LOGGER_FILE)
@@ -50,6 +53,7 @@ def get_logger_config():
format="%(levelname)s: %(asctime)s \t%(message)s",
date_format="%d-%b-%y %H:%M:%S",
logger_file=LOGGER_FILE,
level=log_level,
)

View File

@@ -30,6 +30,7 @@ class AppSettings(BaseSettings):
API_DOCS: bool = True
TOKEN_TIME: int = 48 # Time in Hours
SECRET: str
LOG_LEVEL: str = "INFO" # Corresponds to standard Python log levels.
GIT_COMMIT_HASH: str = "unknown"