go-colorable

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

Github stars Tracking Chart

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)


Main metrics

Overview
Name With Ownermattn/go-colorable
Primary LanguageGo
Program languageGo (Language Count: 2)
PlatformWindows
License:MIT License
所有者活动
Created At2014-07-30 02:38:06
Pushed At2025-01-10 08:33:50
Last Commit At2025-01-10 17:33:50
Release Count24
Last Release Namev0.1.14 (Posted on )
First Release Namev0.0.1 (Posted on )
用户参与
Stargazers Count802
Watchers Count18
Fork Count98
Commits Count161
Has Issues Enabled
Issues Count25
Issue Open Count8
Pull Requests Count36
Pull Requests Open Count1
Pull Requests Close Count13
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

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)