onelog
onelog copied to clipboard
Windows color
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"}
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")
}