onelog icon indicating copy to clipboard operation
onelog copied to clipboard

Windows color

Open ghost opened this issue 6 years ago • 1 comments

Using this file:

package main
import (
   "github.com/fatih/color"
   "github.com/francoispqt/onelog"
   "os"
)
func main() {
   onelog.LevelText(onelog.INFO, color.CyanString("INFO"))
   aa := onelog.New(os.Stdout, onelog.ALL)
   aa.Info("bbbbb")
}

I get this result:

{"level":" [36mINFO [0m","message":"bbbbb"}

ghost avatar Jun 15 '19 00:06 ghost

Workaround:

package main
import (
   "github.com/fatih/color"
   "github.com/francoispqt/onelog"
   "github.com/mattn/go-colorable"
)
func main() {
   onelog.LevelText(onelog.INFO, color.CyanString("INFO"))
   aa := onelog.New(colorable.NewColorableStdout(), onelog.ALL)
   aa.Info("bb")
}

Or:

package main
import "github.com/labstack/gommon/log"
func main() {
   log.EnableColor()
   log.Info("bb")
}

ghost avatar Jun 23 '19 20:06 ghost