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)


Overview

Name With Ownermattn/go-colorable
Primary LanguageGo
Program languageGo (Language Count: 2)
PlatformWindows
License:MIT License
Release Count23
Last Release Namev0.1.13 (Posted on )
First Release Namev0.0.1 (Posted on )
Created At2014-07-30 02:38:06
Pushed At2024-01-17 17:59:04
Last Commit At2023-03-22 23:30:39
Stargazers Count741
Watchers Count19
Fork Count97
Commits Count154
Has Issues Enabled
Issues Count24
Issue Open Count7
Pull Requests Count33
Pull Requests Open Count2
Pull Requests Close Count10
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)

To the top