commit | d9a68d594368e217e6261d4d830d0d64183466d6 | [log] [tgz] |
---|---|---|
author | Olivier Mengué <dolmen@cpan.org> | Tue Mar 21 21:15:09 2023 |
committer | Olivier Mengué <dolmen@cpan.org> | Tue Mar 21 21:15:09 2023 |
tree | 9e9c418f399a1dba5b55cf3c332bd370e9c94a5e | |
parent | 11a925cff3d38c293ddc8c05a16b504e3e2c63be [diff] |
Merge colorable_appengine.go into colorable_others.go The only difference between colorable_appengine.go and colorable_others.go was the build tags. So let's merge code, preserving build tags.
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)