File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "fmt"
55 "io"
66 "os"
7- "strings"
87
98 "github.com/motemen/go-colorine"
109)
@@ -51,16 +50,13 @@ var (
5150)
5251
5352func init () {
54- SelectLogger ()
53+ selectLogger ()
5554}
5655
57- func SelectLogger () {
58- v := os .Getenv ("NO_COLOR" )
59-
60- if strings .ToLower (v ) == "true" {
56+ func selectLogger () {
57+ if os .Getenv ("NO_COLOR" ) != "" {
6158 logger = loggerWithoutColor
6259 }
63-
6460 SetOutput (os .Stderr )
6561}
6662
Original file line number Diff line number Diff line change 88func TestLog (t * testing.T ) {
99 t .Run ("with color" , func (t * testing.T ) {
1010 t .Logf ("NO_COLOR: %s" , os .Getenv ("NO_COLOR" ))
11- SelectLogger ()
11+ selectLogger ()
1212 // info
1313 Log ("default" , "should be green" )
1414 // verbose
@@ -25,7 +25,7 @@ func TestLog(t *testing.T) {
2525 t .Run ("without color" , func (t * testing.T ) {
2626 t .Setenv ("NO_COLOR" , "true" )
2727 t .Logf ("NO_COLOR: %s" , os .Getenv ("NO_COLOR" ))
28- SelectLogger ()
28+ selectLogger ()
2929 // info
3030 Log ("default" , "should be none" )
3131 // verbose
You can’t perform that action at this time.
0 commit comments