harishdurga / logrus-lumberjack-hook

Logrus hook for Lumberjack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)
}

About

Logrus hook for Lumberjack


Languages

Language:Go 100.0%