Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Commit

Permalink
Merge pull request sirupsen#251 from devopstaku/syslog_hook_doc
Browse files Browse the repository at this point in the history
Add description about how to connect to local syslog with syslog hook
  • Loading branch information
sirupsen committed Oct 5, 2015
2 parents 418b41d + 4805f72 commit a6a8245
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func init() {
}
}
```

Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md).

| Hook | Description |
| ----- | ----------- |
Expand Down
19 changes: 19 additions & 0 deletions hooks/syslog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ func main() {
}
}
```

If you want to connect to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). Just assign empty string to the first two parameters of `NewSyslogHook`. It should look like the following.

```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("", "", syslog.LOG_INFO, "")

if err == nil {
log.Hooks.Add(hook)
}
}
```

0 comments on commit a6a8245

Please sign in to comment.