logrus在windows的terminal下彩色显示

来源:互联网 发布:变老软件 编辑:程序博客网 时间:2024/05/23 20:55
  • go version 1.8.3 windows/amd64
  • logrus version 1.0.2
// import this libraryimport "github.com/shiena/ansicolor"import  log "github.com/sirupsen/logrus"// force colors on for TextFormatterlog.Formatter = &logrus.TextFormatter{    ForceColors: true,}// then wrap the log output with itlog.SetOutPut(ansicolor.NewAnsiColorWriter(os.Stdout))

参考:https://github.com/sirupsen/logrus/issues/172#issuecomment-147143824

原创粉丝点击