[Core][Logging] Fix JSON logging process decoration (#57957)

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
This commit is contained in:
Mark McLoughlin
2026-09-25 10:12:28 -06:00
committed by GitHub
parent 38cc054fc2
commit a44d7b5151
6 changed files with 113 additions and 56 deletions
+9
View File
@@ -91,11 +91,20 @@ class ColoredFormatter(NewLineFormatter):
"CRITICAL": "\033[35m", # Magenta
}
GREY = "\033[90m" # Grey for timestamp and file info
PROCESS_PREFIX_COLOR = "\033[0;36m"
PROCESS_PREFIX_RESET = "\033[0;0m"
RESET = "\033[0m"
def __init__(self, fmt, datefmt=None, style="%", *, log_level: str | None = None):
# Inject grey color codes into format string for timestamp and file info
if fmt:
# Wrap process prefix with cyan
fmt = fmt.replace(
"(%(vllm_process_name)s pid=%(process)d)",
f"{self.PROCESS_PREFIX_COLOR}"
"(%(vllm_process_name)s pid=%(process)d)"
f"{self.PROCESS_PREFIX_RESET}",
)
# Wrap %(asctime)s with grey
fmt = fmt.replace("%(asctime)s", f"{self.GREY}%(asctime)s{self.RESET}")
# Wrap [%(fileinfo)s:%(lineno)d] with grey