MCPcopy
hub / github.com/ModelTC/LightLLM / NewLineFormatter

Class NewLineFormatter

lightllm/utils/log_utils.py:18–29  ·  view source on GitHub ↗

Adds logging prefix to newlines to align multi-line messages.

Source from the content-addressed store, hash-verified

16
17
18class NewLineFormatter(logging.Formatter):
19 """Adds logging prefix to newlines to align multi-line messages."""
20
21 def __init__(self, fmt, datefmt=None):
22 logging.Formatter.__init__(self, fmt, datefmt)
23
24 def format(self, record):
25 msg = logging.Formatter.format(self, record)
26 if record.message != "":
27 parts = msg.split(record.message)
28 msg = msg.replace("\n", "\r\n" + parts[0])
29 return msg
30
31
32_root_logger = logging.getLogger("lightllm")

Callers 2

_setup_loggerFunction · 0.85
init_loggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected