diff --git a/vllm_omni/entrypoints/cli/logo.py b/vllm_omni/entrypoints/cli/logo.py index addfe3593..b33208399 100644 --- a/vllm_omni/entrypoints/cli/logo.py +++ b/vllm_omni/entrypoints/cli/logo.py @@ -1,6 +1,7 @@ +import os import re -from vllm.logger import current_formatter_type, init_logger +from vllm.logger import init_logger logger = init_logger(__name__) @@ -41,5 +42,11 @@ _ANSI_RE = re.compile(r"\033\[[0-9;]*m") def log_logo() -> None: - logo = LOGO if current_formatter_type(logger) == "color" else _ANSI_RE.sub("", LOGO) + # Bypass current_formatter_type() which has fragile handler-count/name + # checks that fail in some runtime configurations. Instead, directly + # check the env vars that control colored output — matching vLLM's + # _use_color() logic. main.py sets VLLM_LOGGING_COLOR=1 before any + # vLLM import, so this env var is the authoritative source of truth. + use_color = "NO_COLOR" not in os.environ and os.environ.get("VLLM_LOGGING_COLOR") != "0" + logo = LOGO if use_color else _ANSI_RE.sub("", LOGO) logger.info(logo) diff --git a/vllm_omni/entrypoints/cli/main.py b/vllm_omni/entrypoints/cli/main.py index affa6c833..44d809466 100644 --- a/vllm_omni/entrypoints/cli/main.py +++ b/vllm_omni/entrypoints/cli/main.py @@ -15,6 +15,14 @@ def main(): vllm_main() return else: + # Force colored logging even when piped (e.g. `| tee`). + # Must be set before any vLLM import because the logger + # formatter is configured at import time via _use_color(). + import os + + if "VLLM_LOGGING_COLOR" not in os.environ: + os.environ["VLLM_LOGGING_COLOR"] = "1" + from vllm.entrypoints.utils import VLLM_SUBCMD_PARSER_EPILOG, cli_env_setup from vllm.utils.argparse_utils import FlexibleArgumentParser