commit | 22a0a28efddc09a2f1016544fb391c2a7b78b1ca | [log] [tgz] |
---|---|---|
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | Tue May 03 04:04:05 2016 |
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | Tue May 03 04:04:05 2016 |
tree | 129f1193805e41affc0fee3323f48531e7826eee | |
parent | 6dbf6132aecdd934a1013a23455c8cb1f67fa84f [diff] |
restore cursor position
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)