commit | 4e32bdb9fe4eefa9b10cb112e44debf77784ff7a | [log] [tgz] |
---|---|---|
author | mattn <mattn.jp@gmail.com> | Fri Feb 28 03:30:15 2020 |
committer | GitHub <noreply@github.com> | Fri Feb 28 03:30:15 2020 |
tree | dc1b8c606913fdcc490c9dfeadf526442d1d3126 | |
parent | d58279a0cb8d137d14e3373472e4fdbd1810c439 [diff] | |
parent | 68e95eba382c972aafde02ead2cd2426a8a92480 [diff] |
Merge pull request #46 from mattn/enablecolor Add EnableColorsStdout
Colorable writer for windows.
For example, most of logger packages doesn‘t show colors on windows. (I know we can do it with ansicon. But I don’t want.) This package is possible to handle escape sequence for ansi color on windows.
logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
logrus.SetOutput(colorable.NewColorableStdout())
logrus.Info("succeeded")
logrus.Warn("not correct")
logrus.Error("something error")
logrus.Fatal("panic")
You can compile above code on non-windows OSs.
$ go get github.com/mattn/go-colorable
MIT
Yasuhiro Matsumoto (a.k.a mattn)