jazzdotdev / jazz

The Scripting Engine that Combines Speed, Safety, and Simplicity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable log colors when not connected to a terminal

sineemore opened this issue · comments

One more issue I can think off is undesired colored logs in standard output: by default logs in terminal are colored, we can toggle color support with enviroment variable NO_COLOR. But when I redirect torchbear command to a file (or a subprocess like in pipeline above) the colored logs will make it trough and reside in file.

You can test it with simple init.lua, which will raise a colored error:

#yyy
Run it like this:
$ torchbear init.lua > out.log && less out.log

The out.log will contain the escape sequences. I guess it is wrong behaviour.

isatty can help.