Files
enginex-mlu370-vllm/vllm-v0.6.2/vllm/logging_utils/formatter.py

16 lines
486 B
Python
Raw Normal View History

2026-02-04 17:22:39 +08:00
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