feat(log): enable override coloring based on CLICOLOR and CLICOLOR_FORCE (#2657)

This commit is contained in:
ttys3 2022-04-06 00:37:08 +08:00 committed by GitHub
parent f5b92e1ae2
commit a2e6c7674d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,7 @@ func NewStderrLog(name string) *StderrLog {
sl.logger.Out = StdErr
formatter := &logrus.TextFormatter{
DisableTimestamp: true, // `INFO[0007] msg` -> `INFO msg`
EnvironmentOverrideColors: true,
}
if os.Getenv("LOG_TIMESTAMP") == "1" {
formatter.DisableTimestamp = false