func init() { if term.IsTty(os.Stdout.Fd()) { StdoutHandler = StreamHandler(colorable.NewColorableStdout(), TerminalFormat()) } if term.IsTty(os.Stderr.Fd()) { StderrHandler = StreamHandler(colorable.NewColorableStderr(), TerminalFormat()) } root = &logger{[]interface{}{}, new(swapHandler)} root.SetHandler(LvlFilterHandler(LvlError, StdoutHandler)) }
func getLogFormat(format string) log15.Format { switch format { case "console": if term.IsTty(os.Stdout.Fd()) { return log15.TerminalFormat() } return log15.LogfmtFormat() case "text": return log15.LogfmtFormat() case "json": return log15.JsonFormat() default: return log15.LogfmtFormat() } }