Disable colored output on windows entirely

Currently the textformatter on windows outputs 

``←[31mERRO←[0m[0000] test windows``

when coloring is not disabled explicitly.
However, windows up to windows 8.1 does not support colored output on cmd entirely. Windows 10 added support for it, which is off by default and has to be enabled via registry or environment variable. Therefore i suggest removing colored output on windows entirely to make the output usable again.
This commit is contained in:
ceriath 2018-11-16 15:17:01 +01:00 committed by GitHub
parent 91da99df23
commit e9026580bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"os" "os"
"runtime"
"sort" "sort"
"strings" "strings"
"sync" "sync"
@ -102,7 +103,7 @@ func (f *TextFormatter) isColored() bool {
} }
} }
return isColored && !f.DisableColors return isColored && !f.DisableColors && (runtime.GOOS != "windows")
} }
// Format renders a single log entry // Format renders a single log entry