Exemplo n.º 1
0
func init() {
	log.SetLevel(log.DebugLevel)
	log.SetFormatter(&log.BadooFormatter{})

	stderrLogger = &log.Logger{
		Out:       os.Stderr,
		Formatter: &log.BadooFormatter{},
		Level:     log.DebugLevel,
	}

}
Exemplo n.º 2
0
func reopenLogfile(path string, level log.Level) (err error) {
	if err := initSyslogHook(); err != nil {
		return err
	}

	log.SetLevel(level)

	if "" == path || "-" == path {
		log.SetOutput(os.Stderr)
	} else {
		logfile, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
		if nil != err {
			return err
		}
		log.SetOutput(logfile)
	}

	logPath = path
	logLevel = level

	return nil
}