go-colorable

Windows 上的可着色写入器。「Colorable writer for windows.」

Github星跟蹤圖

go-colorable

Windows 上的可着色写入器。

例如,大多数的日志程序包在 windows 上都不显示颜色。(我知道我们可以用 ansicon 来做,但我不希望这样。)这个包可以在 windows 上处理 ansi 颜色的转义序列。

太糟糕了!

太好啦!

使用方法

logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
logrus.SetOutput(colorable.NewColorableStdout())

logrus.Info("succeeded")
logrus.Warn("not correct")
logrus.Error("something error")
logrus.Fatal("panic")

你可以在非 windows 操作系统上编译上述代码。

安装

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

许可证

MIT

作者

Yasuhiro Matsumoto (a.k.a mattn)


概覽

名稱與所有者mattn/go-colorable
主編程語言Go
編程語言Go (語言數: 2)
平台Windows
許可證MIT License
發布數23
最新版本名稱v0.1.13 (發布於 )
第一版名稱v0.0.1 (發布於 )
創建於2014-07-30 02:38:06
推送於2024-01-17 17:59:04
最后一次提交2023-03-22 23:30:39
星數742
關注者數19
派生數96
提交數154
已啟用問題?
問題數24
打開的問題數7
拉請求數33
打開的拉請求數2
關閉的拉請求數10
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

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)

去到頂部