A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 17, 04:15 UTC
Make vLLM logging formatting optional (#2877)
Antoni Baum committed
Feb 20, 2024 at 14:38 UTC
181b27d8813e6a92de4f38cecfa24914e652588a
1 file changed
+7
-3
vllm/logger.py
+7
-3
@@ -5,6 +5,8 @@ import logging
5
import sys
6
import os
7
8
+VLLM_CONFIGURE_LOGGING = int(os.getenv("VLLM_CONFIGURE_LOGGING", "1"))
9
+
10
_FORMAT = "%(levelname)s %(asctime)s %(filename)s:%(lineno)d] %(message)s"
11
_DATE_FORMAT = "%m-%d %H:%M:%S"
12
@@ -45,13 +47,15 @@ def _setup_logger():
47
# The logger is initialized when the module is imported.
48
# This is thread-safe as the module is only imported once,
49
# guaranteed by the Python GIL.
48
-_setup_logger()
50
+if VLLM_CONFIGURE_LOGGING:
51
+ _setup_logger()
52
53
54
def init_logger(name: str):
55
# Use the same settings as above for root logger
56
logger = logging.getLogger(name)
57
logger.setLevel(os.getenv("LOG_LEVEL", "DEBUG"))
55
- logger.addHandler(_default_handler)
56
- logger.propagate = False
58
+ if VLLM_CONFIGURE_LOGGING:
59
+ logger.addHandler(_default_handler)
60
+ logger.propagate = False
61
return logger