[Doc] Add typing hints / mypy types cleanup (#3816)
Co-authored-by: Roger Wang <136131678+ywang96@users.noreply.github.com>
This commit is contained in:
co-authored by
Roger Wang
parent
e46a60aa4c
commit
c2b4a1bce9
+7
-1
@@ -4,6 +4,7 @@
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
VLLM_CONFIGURE_LOGGING = int(os.getenv("VLLM_CONFIGURE_LOGGING", "1"))
|
||||
|
||||
@@ -26,7 +27,7 @@ class NewLineFormatter(logging.Formatter):
|
||||
|
||||
|
||||
_root_logger = logging.getLogger("vllm")
|
||||
_default_handler = None
|
||||
_default_handler: Optional[logging.Handler] = None
|
||||
|
||||
|
||||
def _setup_logger():
|
||||
@@ -55,7 +56,12 @@ 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"))
|
||||
|
||||
if VLLM_CONFIGURE_LOGGING:
|
||||
if _default_handler is None:
|
||||
raise ValueError(
|
||||
"_default_handler is not set up. This should never happen!"
|
||||
" Please open an issue on Github.")
|
||||
logger.addHandler(_default_handler)
|
||||
logger.propagate = False
|
||||
return logger
|
||||
|
||||
Reference in New Issue
Block a user