Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable color in logs when not printing to a tty #18662

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

wenbinlyuTT
Copy link
Contributor

Ticket

N/A

Problem description

The logger applies text styling that only work in the terminal, if we use the log file env var or redirect stdout to a file then we end up with

^[[38;2;000;128;000m                  Metal^[[0m | ^[[1m^[[38;2;100;149;237mINFO    ^[[0m | Initializing device 0. Program cache is NOT enabled
^[[38;2;000;128;000m                  Metal^[[0m | ^[[1m^[[38;2;100;149;237mINFO    ^[[0m | AI CLK for device 0 is:   1000 MHz
^[[38;2;000;128;000m                  Metal^[[0m | ^[[1m^[[38;2;100;149;237mINFO    ^[[0m | Enabling program cache on device 0

What's changed

Modify the logger to disable all fmt styling if the output isn't a tty.

Signed-off-by: wenbinlyuTT <wenbinlyu@tenstorrent.com>
@wenbinlyuTT wenbinlyuTT merged commit 769d3d0 into main Mar 6, 2025
13 checks passed
@wenbinlyuTT wenbinlyuTT deleted the wenbinlyu/tty_color branch March 6, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants