blablacar / dgr

Container build and runtime tool
Apache License 2.0
248 stars 21 forks source link

(colored) Log output when run with Jenkins Pipeline #188

Open BenjaminHerbert opened 8 years ago

BenjaminHerbert commented 8 years ago

When I run dgr in a Jenkins Pipeline, color codes (presumably) are shown in the log output:

09:33:05 DEBUG  dgr/bin-dgr/home.go:60  Loading home  path=/home/core/.config/dgr

Is there a way to suppress the color codes? This would make the output more readable.

I saw that there is a useColor bool in vendor/github.com/n0rad/go-erlog/formatter.go is that supposed to turn off colors in the log?

BenjaminHerbert commented 8 years ago

I just found, Jenkins prints nicely colored if you wrap the step in the following:

wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
  sh 'dgr build'
}
n0rad commented 8 years ago

formatter.go detect if there is a TTY to know If it should use color or not.

This is useful for pure go application but probably not enough for dgr where there is logs inside build run by bash scripts.

A --no-color argument, propagated to build is needed.