mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix: also check isatty() for ANSI color in logging formatter
Align with _supports_color() convention in setup_wizard.py which checks both sys.stdout.isatty() and NO_COLOR. This ensures piped/file output also gets plain text without ANSI escape codes.
This commit is contained in:
parent
161662dfaa
commit
7d8bd06252
1 changed files with 1 additions and 1 deletions
|
|
@ -249,7 +249,7 @@ if json_logs:
|
|||
handler.setFormatter(JsonFormatter())
|
||||
_setup_json_exception_handlers(JsonFormatter())
|
||||
else:
|
||||
if os.environ.get("NO_COLOR") is None:
|
||||
if sys.stdout.isatty() and os.environ.get("NO_COLOR") is None:
|
||||
_format_str = "\033[92m%(asctime)s - %(name)s:%(levelname)s\033[0m: %(filename)s:%(lineno)s - %(message)s"
|
||||
else:
|
||||
_format_str = "%(asctime)s - %(name)s:%(levelname)s: %(filename)s:%(lineno)s - %(message)s"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue