From 7556e245e22e7d23e075791afabadce5cfc4516a Mon Sep 17 00:00:00 2001 From: David Bariod Date: Sun, 2 Sep 2018 20:22:06 +0200 Subject: [PATCH 1/3] Use syslog instead of airbrake as syslog example The purpose is to reduce package dependencies, fixes #809. --- example_hook_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/example_hook_test.go b/example_hook_test.go index d4ddffc..b997c56 100644 --- a/example_hook_test.go +++ b/example_hook_test.go @@ -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{ From 8b120431f3f374c0365f24021322dda147714c24 Mon Sep 17 00:00:00 2001 From: David Bariod Date: Mon, 3 Sep 2018 21:58:50 +0200 Subject: [PATCH 2/3] Fix example build on windows --- example_hook_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example_hook_test.go b/example_hook_test.go index b997c56..4e4ea1d 100644 --- a/example_hook_test.go +++ b/example_hook_test.go @@ -1,3 +1,5 @@ +// +build !windows + package logrus_test import ( From 4bcb47b846362274026619052b2dcec92328ab62 Mon Sep 17 00:00:00 2001 From: David Bariod Date: Tue, 4 Sep 2018 22:15:13 +0200 Subject: [PATCH 3/3] commit to trigger appveyor build --- example_hook_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/example_hook_test.go b/example_hook_test.go index 4e4ea1d..28bd8ea 100644 --- a/example_hook_test.go +++ b/example_hook_test.go @@ -9,6 +9,7 @@ import ( "os" ) +// An example on how to use a hook func Example_hook() { var log = logrus.New() log.Formatter = new(logrus.TextFormatter) // default