Example #1
0
func init() {
	log.Formatter = new(logrus.JSONFormatter)
	tmp := new(logrus.TextFormatter) // default
	tmp.ForceUnColored = false
	tmp.DisableTimestamp = true
	log.Formatter = tmp
	log.Level = logrus.DebugLevel
	tmp2 := new(logrus.TextFormatter) // default
	tmp2.ForceUnColored = true
	tmp2.DisableTimestamp = true
	log.Hooks.Add(lfshook.NewHook(lfshook.PathMap{
		logrus.InfoLevel:  "log.log",
		logrus.ErrorLevel: "log.log",
		logrus.DebugLevel: "log.log",
		logrus.PanicLevel: "log.log",
		logrus.FatalLevel: "log.log",
		logrus.WarnLevel:  "log.log",
	}, new(logrus.JSONFormatter)))
}