Use syslog instead of airbrake as syslog example

The purpose is to reduce package dependencies, fixes #809.
This commit is contained in:
David Bariod 2018-09-02 20:22:06 +02:00
parent 78fa2915c1
commit 7556e245e2
1 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,8 @@ package logrus_test
import (
"github.com/sirupsen/logrus"
"gopkg.in/gemnasium/logrus-airbrake-hook.v2"
slhooks "github.com/sirupsen/logrus/hooks/syslog"
"log/syslog"
"os"
)
@ -10,7 +11,9 @@ func Example_hook() {
var log = logrus.New()
log.Formatter = new(logrus.TextFormatter) // default
log.Formatter.(*logrus.TextFormatter).DisableTimestamp = true // remove timestamp from test output
log.Hooks.Add(airbrake.NewHook(123, "xyz", "development"))
if sl, err := slhooks.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, ""); err != nil {
log.Hooks.Add(sl)
}
log.Out = os.Stdout
log.WithFields(logrus.Fields{