mirror of https://github.com/sirupsen/logrus.git
Fix for CLICOLOR_FORCE handling
This commit is contained in:
parent
37d651c1f2
commit
eb968b6506
|
@ -37,7 +37,7 @@ type TextFormatter struct {
|
|||
DisableColors bool
|
||||
|
||||
// Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/
|
||||
OverrideColors bool
|
||||
EnvironmentOverrideColors bool
|
||||
|
||||
// Disable timestamp logging. useful when output is redirected to logging
|
||||
// system that already adds timestamps.
|
||||
|
@ -85,12 +85,12 @@ func (f *TextFormatter) init(entry *Entry) {
|
|||
func (f *TextFormatter) isColored() bool {
|
||||
isColored := f.ForceColors || f.isTerminal
|
||||
|
||||
if f.OverrideColors {
|
||||
if f.EnvironmentOverrideColors {
|
||||
if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" {
|
||||
isColored = true
|
||||
}
|
||||
|
||||
if os.Getenv("CLICOLOR") == "0" {
|
||||
} else if ok && force == "0" {
|
||||
isColored = false
|
||||
} else if os.Getenv("CLICOLOR") == "0" {
|
||||
isColored = false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue