forked from mirror/logrus
21 lines
455 B
Markdown
21 lines
455 B
Markdown
# Syslog Hooks for Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/>
|
|
|
|
## Usage
|
|
|
|
```go
|
|
import (
|
|
"log/syslog"
|
|
"github.com/Sirupsen/logrus"
|
|
logrus_syslog "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)
|
|
}
|
|
}
|
|
```
|