From 29d30d9f63041b476217e4ff8bfbbe788ee06c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20F=20R=C3=B8dseth?= Date: Tue, 12 May 2015 16:31:17 +0200 Subject: [PATCH] Terminals on Windows may not have colors --- text_formatter.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/text_formatter.go b/text_formatter.go index 612417f..4ed90e1 100644 --- a/text_formatter.go +++ b/text_formatter.go @@ -3,6 +3,7 @@ package logrus import ( "bytes" "fmt" + "runtime" "sort" "strings" "time" @@ -69,7 +70,8 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) { prefixFieldClashes(entry.Data) - isColored := (f.ForceColors || isTerminal) && !f.DisableColors + isColorTerminal := isTerminal && (runtime.GOOS != "windows") + isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors if f.TimestampFormat == "" { f.TimestampFormat = DefaultTimestampFormat