commit | 65e63775d1ac5ab639585f6771fab74a808d1424 | [log] [tgz] |
---|---|---|
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | Fri Feb 28 02:36:56 2020 |
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | Fri Feb 28 02:36:56 2020 |
tree | f0e9ae2d51987447de28e4f73f509dccccfdbd36 | |
parent | c742d6fb21c22a5bb6f768a683e6782e52fe0311 [diff] |
Return the file if ENABLE_VIRTUAL_TERMINAL_PROCESSING is enabled
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)