Skip to content

Commit 29d30d9

Browse files
committed
Terminals on Windows may not have colors
1 parent aaf92c9 commit 29d30d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

text_formatter.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package logrus
33
import (
44
"bytes"
55
"fmt"
6+
"runtime"
67
"sort"
78
"strings"
89
"time"
@@ -69,7 +70,8 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
6970

7071
prefixFieldClashes(entry.Data)
7172

72-
isColored := (f.ForceColors || isTerminal) && !f.DisableColors
73+
isColorTerminal := isTerminal && (runtime.GOOS != "windows")
74+
isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors
7375

7476
if f.TimestampFormat == "" {
7577
f.TimestampFormat = DefaultTimestampFormat

0 commit comments

Comments
 (0)