https://github.com/mattn/go-colorable.git
|
|
5 سال پیش | |
|---|---|---|
| .github | 6 سال پیش | |
| _example | 5 سال پیش | |
| cmd | 8 سال پیش | |
| .travis.yml | 8 سال پیش | |
| LICENSE | 9 سال پیش | |
| README.md | 8 سال پیش | |
| colorable_appengine.go | 6 سال پیش | |
| colorable_others.go | 6 سال پیش | |
| colorable_test.go | 7 سال پیش | |
| colorable_windows.go | 6 سال پیش | |
| go.mod | 5 سال پیش | |
| go.sum | 5 سال پیش | |
| noncolorable.go | 6 سال پیش |
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)