[Bugfix] Suppress non-TTY color output on the process name part of the log (#29714)

Signed-off-by: Tsukasa OI <floss_llm@irq.a4lg.com>
This commit is contained in:
Tsukasa OI
2026-02-06 03:47:09 +09:00
committed by GitHub
parent 87d0d17ab5
commit 92e7562a99

View File

@@ -179,7 +179,12 @@ def set_process_title(
def _add_prefix(file: TextIO, worker_name: str, pid: int) -> None:
"""Add colored prefix to file output for log decoration."""
if envs.NO_COLOR:
is_tty = hasattr(file, "isatty") and file.isatty()
if (
envs.NO_COLOR
or envs.VLLM_LOGGING_COLOR == "0"
or (envs.VLLM_LOGGING_COLOR != "1" and not is_tty)
):
prefix = f"({worker_name} pid={pid}) "
else:
prefix = f"{CYAN}({worker_name} pid={pid}){RESET} "