Пример #1
0
func (l *loggingT) getColorByte(s severity, b []byte) []byte {
	var c gocolorize.Colorize
	switch s {
	case warningLog:
		c = gocolorize.NewColor("yellow")
	case errorLog:
		c = gocolorize.NewColor("red")
	case fatalLog:
		c = gocolorize.NewColor("magenta")
	default:
		c = gocolorize.NewColor("green")
	}
	return []byte(c.Paint(string(b)))
}
Пример #2
0
func ColorSuccess(message string) string {
	success := gocolorize.Colorize{Fg: gocolorize.Green}
	return success.Paint(message)
}
Пример #3
0
func ColorError(message string) string {
	err := gocolorize.Colorize{Fg: gocolorize.Red}
	err.ToggleBold()
	return err.Paint(message)
}
Пример #4
0
func ColorWarning(message string) string {
	warning := gocolorize.Colorize{Fg: gocolorize.Yellow}
	return warning.Paint(message)
}
Пример #5
0
func ColorInfo(message string) string {
	info := gocolorize.Colorize{Fg: gocolorize.Magenta}
	return info.Paint(message)
}
Пример #6
0
func newColorLogger(out io.Writer, severity string, color gocolorize.Color) *log.Logger {
	c := gocolorize.Colorize{Fg: color}
	return log.New(out, c.Paint("severity:"+severity)+"\t", log.Ldate|log.Ltime|log.Lshortfile)
}