From 58cc2b3fec9c4cce0e5797fc26db6d4d23842c82 Mon Sep 17 00:00:00 2001 From: Didip Kerabat Date: Fri, 18 Jul 2014 15:45:49 -0700 Subject: [PATCH 1/3] Added README --- hooks/syslog/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 hooks/syslog/README.md diff --git a/hooks/syslog/README.md b/hooks/syslog/README.md new file mode 100644 index 0000000..74dc73f --- /dev/null +++ b/hooks/syslog/README.md @@ -0,0 +1,20 @@ +# Syslog Hooks for Logrus :walrus: + +## Usage + +```go +import ( + "log/syslog" + "github.com/Sirupsen/logrus" + "github.com/Sirupsen/logrus/hooks/syslog" +) + +func main() { + log := logrus.New() + hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") + + if err == nil { + log.Hooks.Add(hook) + } +} +``` \ No newline at end of file From 24b6c463ab744d1029fc92ed0adaf49db1761083 Mon Sep 17 00:00:00 2001 From: Didip Kerabat Date: Fri, 18 Jul 2014 15:47:34 -0700 Subject: [PATCH 2/3] Update frontpage README --- README.md | 3 +++ hooks/syslog/README.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 41e23ef..fb98376 100644 --- a/README.md +++ b/README.md @@ -148,12 +148,15 @@ Logrus comes with built-in hooks. Add those, or your custom hook, in `init`: ```go import ( + "log/syslog" "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus/hooks/airbrake" + "github.com/Sirupsen/logrus/hooks/syslog" ) func init() { log.Hooks.Add(new(logrus_airbrake.AirbrakeHook)) + log.Hooks.Add(logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")) } ``` diff --git a/hooks/syslog/README.md b/hooks/syslog/README.md index 74dc73f..cd706bc 100644 --- a/hooks/syslog/README.md +++ b/hooks/syslog/README.md @@ -11,7 +11,7 @@ import ( func main() { log := logrus.New() - hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") + hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") if err == nil { log.Hooks.Add(hook) From 90a435e26a6095350f3ae16a832b21813c90b11d Mon Sep 17 00:00:00 2001 From: Didip Kerabat Date: Fri, 18 Jul 2014 15:48:56 -0700 Subject: [PATCH 3/3] Update more README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index fb98376..ef107e7 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,10 @@ func init() { Send errors to an exception tracking service compatible with the Airbrake API. Uses [`airbrake-go`](https://github.com/tobi/airbrake-go) behind the scenes. +* [`github.com/Sirupsen/logrus/hooks/syslog`](https://github.com/Sirupsen/logrus/blob/master/hooks/syslog/syslog.go). + Send errors to remote syslog server. + Uses standard library `log/syslog` behind the scenes. + #### Level logging Logrus has six logging levels: Debug, Info, Warning, Error, Fatal and Panic.