Skip to content

Commit

Permalink
Merge pull request #93 from AlpinDale/chore/log-level
Browse files Browse the repository at this point in the history
chore: make log level configurable via env variable
  • Loading branch information
bdashore3 authored Apr 2, 2024
2 parents f9f8c97 + 1650e6e commit cdb96e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions common/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""

import logging
import os

from loguru import logger
from rich.console import Console
from rich.markup import escape
Expand All @@ -18,6 +20,7 @@
from common.utils import unwrap

RICH_CONSOLE = Console()
LOG_LEVEL = os.getenv("TABBY_LOG_LEVEL", "INFO")


def get_loading_progress_bar():
Expand Down Expand Up @@ -87,7 +90,7 @@ def emit(self, record: logging.LogRecord) -> None:
"class": f"{UvicornLoggingHandler.__module__}.{UvicornLoggingHandler.__qualname__}", # noqa
},
},
"root": {"handlers": ["uvicorn"], "propagate": False, "level": "INFO"},
"root": {"handlers": ["uvicorn"], "propagate": False, "level": LOG_LEVEL},
}


Expand All @@ -98,7 +101,7 @@ def setup_logger():

logger.add(
RICH_CONSOLE.print,
level="INFO",
level=LOG_LEVEL,
format=_log_formatter,
colorize=True,
)

0 comments on commit cdb96e4

Please sign in to comment.