Esempio n. 1
0
File: echo.go Progetto: jllopis/try6
// ColoredLog enable/disable colored log.
func (e *Echo) ColoredLog(on bool) {
	if on {
		color.Enable()
	} else {
		color.Disable()
	}
}
Esempio n. 2
0
File: log.go Progetto: o1egl/gommon
func (l *Logger) SetOutput(w io.Writer) {
	l.out = w
	color.Disable()

	if w, ok := w.(*os.File); ok && isatty.IsTerminal(w.Fd()) {
		color.Enable()
	}

	// NOTE: Reintialize levels to reflect color enable/disable call.
	initLevels()
}
Esempio n. 3
0
func (l *Logger) SetOutput(w io.Writer) {
	l.out = w
	l.err = w

	switch w := w.(type) {
	case *os.File:
		if isatty.IsTerminal(w.Fd()) {
			color.Enable()
		}
	default:
		color.Disable()
	}

	// NOTE: Reintialize levels to reflect color enable/disable call.
	initLevels()
}
Esempio n. 4
0
File: log.go Progetto: mattn/gommon
func (l *Logger) SetOutput(w io.Writer) {
	l.out = w
	l.err = w
	color.Disable()

	switch w := w.(type) {
	case *os.File:
		if isatty.IsTerminal(w.Fd()) {
			color.Enable()
		}
		levels = []string{
			color.Cyan("TRACE"),
			color.Blue("DEBUG"),
			color.Green("INFO"),
			color.Magenta("NOTICE"),
			color.Yellow("WARN"),
			color.Red("ERROR"),
			color.RedBg("FATAL"),
		}
	}
}
Esempio n. 5
0
// ColoredLog enable/disable colored log.
func (e *Echo) ColoredLog(on bool) {
	color.Disable()
}
Esempio n. 6
0
File: echo.go Progetto: dre1080/echo
// DisableColoredLog disables colored log.
func (e *Echo) DisableColoredLog() {
	color.Disable()
}