Add NO_COLOR support (#384)

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-05-25 11:37:26 +02:00
committed by GitHub
parent 8c42cb59b0
commit 50c41b85c3

View File

@@ -17,10 +17,13 @@ func Configure(cli *model.Cli) {
var err error var err error
var w io.Writer var w io.Writer
// Adds support for NO_COLOR. More info https://no-color.org/
_, noColor := os.LookupEnv("NO_COLOR")
if !cli.LogJSON { if !cli.LogJSON {
w = zerolog.ConsoleWriter{ w = zerolog.ConsoleWriter{
Out: os.Stdout, Out: os.Stdout,
NoColor: cli.LogNoColor, NoColor: noColor || cli.LogNoColor,
TimeFormat: time.RFC1123, TimeFormat: time.RFC1123,
} }
} else { } else {