Skip to content

Commit

Permalink
fix(backend): ensure log level name is used (not Level 10, etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jul 17, 2024
1 parent 625c146 commit 2858940
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ def emit(self, record):
This happens to be in the 6th frame upward.
"""
logger_opt = log.opt(depth=6, exception=record.exc_info)
logger_opt.log(record.levelno, record.getMessage())
logger_opt.log(logging.getLevelName(record.levelno), record.getMessage())


def get_logger():
"""Override FastAPI logger with custom loguru."""
# Hook all other loggers into ours
logger_name_list = [name for name in logging.root.manager.loggerDict]
for logger_name in logger_name_list:
logging.getLogger(logger_name).setLevel(10)
logging.getLogger(logger_name).setLevel(settings.LOG_LEVEL)
logging.getLogger(logger_name).handlers = []
if logger_name == "sqlalchemy":
# Don't hook sqlalchemy, very verbose
Expand Down

0 comments on commit 2858940

Please sign in to comment.