fallais / logrus-lumberjack-hook

Logrus hook for Lumberjack
2 stars 3 forks source link

Lumberjack Hooks for Logrus :walrus:

Usage

// Set the Lumberjack logger
lumberjackLogger := &lumberjack.Logger{
  Filename:   "/var/log/misc.log",
  MaxSize:    10,
  MaxBackups: 3,
  MaxAge:     3,
  LocalTime:  true,
}

// Add Lumberjack hook
hook, err := logrus_lumberjack.NewLumberjackHook(lumberjackLogger)
if err != nil {
  logrus.Fatalln("Unable to add the Lumberjack hook :", err)
} else {
  logrus.AddHook(hook)
}