Skip to content

Commit

Permalink
Make vLLM logging formatting optional (vllm-project#2877)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yard1 authored and jimpang committed Feb 22, 2024
1 parent 7403f05 commit 042db85
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vllm/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import sys
import os

VLLM_CONFIGURE_LOGGING = int(os.getenv("VLLM_CONFIGURE_LOGGING", "1"))

_FORMAT = "%(levelname)s %(asctime)s %(filename)s:%(lineno)d] %(message)s"
_DATE_FORMAT = "%m-%d %H:%M:%S"

Expand Down Expand Up @@ -45,13 +47,15 @@ def _setup_logger():
# The logger is initialized when the module is imported.
# This is thread-safe as the module is only imported once,
# guaranteed by the Python GIL.
_setup_logger()
if VLLM_CONFIGURE_LOGGING:
_setup_logger()


def init_logger(name: str):
# Use the same settings as above for root logger
logger = logging.getLogger(name)
logger.setLevel(os.getenv("LOG_LEVEL", "DEBUG"))
logger.addHandler(_default_handler)
logger.propagate = False
if VLLM_CONFIGURE_LOGGING:
logger.addHandler(_default_handler)
logger.propagate = False
return logger

0 comments on commit 042db85

Please sign in to comment.