Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norm
vllm
Commits
181b27d8
Unverified
Commit
181b27d8
authored
Feb 20, 2024
by
Antoni Baum
Committed by
GitHub
Feb 20, 2024
Browse files
Make vLLM logging formatting optional (#2877)
parent
63e2a641
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
vllm/logger.py
vllm/logger.py
+7
-3
No files found.
vllm/logger.py
View file @
181b27d8
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment