forked from mirror/logrus
20 lines
426 B
Markdown
20 lines
426 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"
|
||
|
"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)
|
||
|
}
|
||
|
}
|
||
|
```
|