Unverified Commit 181b27d8 authored by Antoni Baum's avatar Antoni Baum Committed by GitHub
Browse files

Make vLLM logging formatting optional (#2877)

parent 63e2a641
...@@ -5,6 +5,8 @@ import logging ...@@ -5,6 +5,8 @@ import logging
import sys import sys
import os import os
VLLM_CONFIGURE_LOGGING = int(os.getenv("VLLM_CONFIGURE_LOGGING", "1"))
_FORMAT = "%(levelname)s %(asctime)s %(filename)s:%(lineno)d] %(message)s" _FORMAT = "%(levelname)s %(asctime)s %(filename)s:%(lineno)d] %(message)s"
_DATE_FORMAT = "%m-%d %H:%M:%S" _DATE_FORMAT = "%m-%d %H:%M:%S"
...@@ -45,13 +47,15 @@ def _setup_logger(): ...@@ -45,13 +47,15 @@ def _setup_logger():
# The logger is initialized when the module is imported. # The logger is initialized when the module is imported.
# This is thread-safe as the module is only imported once, # This is thread-safe as the module is only imported once,
# guaranteed by the Python GIL. # guaranteed by the Python GIL.
_setup_logger() if VLLM_CONFIGURE_LOGGING:
_setup_logger()
def init_logger(name: str): def init_logger(name: str):
# Use the same settings as above for root logger # Use the same settings as above for root logger
logger = logging.getLogger(name) logger = logging.getLogger(name)
logger.setLevel(os.getenv("LOG_LEVEL", "DEBUG")) logger.setLevel(os.getenv("LOG_LEVEL", "DEBUG"))
logger.addHandler(_default_handler) if VLLM_CONFIGURE_LOGGING:
logger.propagate = False logger.addHandler(_default_handler)
logger.propagate = False
return logger return logger
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment