commit | ce7c9ec34570180b85a5c0abc05844ad395938ba | [log] [tgz] |
---|---|---|
author | HAYAMA_Kaoru <iyahaya@nifty.com> | Mon May 04 11:38:35 2020 |
committer | HAYAMA_Kaoru <iyahaya@nifty.com> | Mon May 04 11:40:10 2020 |
tree | 2d592554384f931a8ca52bb2b5979eb4f091424b | |
parent | c10454b8be5ec40b19fbe2656a07b16554a5d8a9 [diff] |
Fix: on Windows 8.1, ESC[7m (REVERSE) did not work.
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)