Clone this repo:
  1. 8bf39a2 Merge pull request #78 from mattn/windows-write-fastpath by mattn · 23 hours ago master v0.1.15
  2. d7a88e0 Bump checkout to v4 and setup-go to v5 by Yasuhiro Matsumoto · 23 hours ago
  3. 4dd1c6d Update CI matrix to Go 1.24-1.26 by Yasuhiro Matsumoto · 23 hours ago
  4. 09158f8 Fast path for plaintext writes and cache text attribute on Windows by Yasuhiro Matsumoto · 23 hours ago
  5. 171d5b4 Add Windows writer benchmarks by Yasuhiro Matsumoto · 23 hours ago

go-colorable

Build Status Codecov GoDoc Go Report Card

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.

Too Bad!

So Good!

Usage

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.

Installation

$ go get github.com/mattn/go-colorable

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)