diff --git a/README.md b/README.md index 41e23ef..ef107e7 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, "")) } ``` @@ -161,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. diff --git a/hooks/syslog/README.md b/hooks/syslog/README.md new file mode 100644 index 0000000..cd706bc --- /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 := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "") + + if err == nil { + log.Hooks.Add(hook) + } +} +``` \ No newline at end of file