commit | a2827f0f3d3636497ded070ba236e9368504cf28 | [log] [tgz] |
---|---|---|
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | Mon Sep 20 16:49:15 2021 |
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | Mon Sep 20 16:49:15 2021 |
tree | 0fe77ede2b3ebc5834c2ef5736404673661c4185 | |
parent | 2e1b0c1546e0173c0907cf05c67b8ba29ed8b4d1 [diff] |
Check result of Write
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)