File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ import (
53
53
"github.com/ethereum/go-ethereum/signer/fourbyte"
54
54
"github.com/ethereum/go-ethereum/signer/rules"
55
55
"github.com/ethereum/go-ethereum/signer/storage"
56
+ colorable "github.com/mattn/go-colorable"
57
+ "github.com/mattn/go-isatty"
56
58
"gopkg.in/urfave/cli.v1"
57
59
)
58
60
@@ -392,7 +394,13 @@ func initialize(c *cli.Context) error {
392
394
}
393
395
fmt .Println ()
394
396
}
395
- log .Root ().SetHandler (log .LvlFilterHandler (log .Lvl (c .Int (logLevelFlag .Name )), log .StreamHandler (logOutput , log .TerminalFormat (true ))))
397
+ usecolor := (isatty .IsTerminal (os .Stderr .Fd ()) || isatty .IsCygwinTerminal (os .Stderr .Fd ())) && os .Getenv ("TERM" ) != "dumb"
398
+ output := io .Writer (logOutput )
399
+ if usecolor {
400
+ output = colorable .NewColorable (logOutput )
401
+ }
402
+ log .Root ().SetHandler (log .LvlFilterHandler (log .Lvl (c .Int (logLevelFlag .Name )), log .StreamHandler (output , log .TerminalFormat (usecolor ))))
403
+
396
404
return nil
397
405
}
398
406
You can’t perform that action at this time.
0 commit comments