From e9026580bf4499404ce258b90d8ea3833919b46e Mon Sep 17 00:00:00 2001 From: ceriath Date: Fri, 16 Nov 2018 15:17:01 +0100 Subject: [PATCH] Disable colored output on windows entirely MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- text_formatter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text_formatter.go b/text_formatter.go index 49ec92f..ed578d2 100644 --- a/text_formatter.go +++ b/text_formatter.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "os" + "runtime" "sort" "strings" "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