Rename vllm.logging to vllm.logging_utils (#10134)

This commit is contained in:
Florian Zimmermeister
2024-11-08 21:53:24 +01:00
committed by GitHub
parent 87713c6053
commit e1b5a82179
6 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,5 @@
from vllm.logging_utils.formatter import NewLineFormatter
__all__ = [
"NewLineFormatter",
]

View File

@@ -0,0 +1,15 @@
import logging
class NewLineFormatter(logging.Formatter):
"""Adds logging prefix to newlines to align multi-line messages."""
def __init__(self, fmt, datefmt=None, style="%"):
logging.Formatter.__init__(self, fmt, datefmt, style)
def format(self, record):
msg = logging.Formatter.format(self, record)
if record.message != "":
parts = msg.split(record.message)
msg = msg.replace("\n", "\r\n" + parts[0])
return msg