2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-19 11:35:14 +00:00
restic/vendor/github.com/sirupsen/logrus/hooks/syslog/syslog_test.go

28 lines
533 B
Go
Raw Normal View History

2017-09-13 12:09:48 +00:00
package syslog
import (
"log/syslog"
"testing"
"github.com/sirupsen/logrus"
)
func TestLocalhostAddAndPrint(t *testing.T) {
log := logrus.New()
hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
if err != nil {
t.Errorf("Unable to connect to local syslog.")
}
log.Hooks.Add(hook)
for _, level := range hook.Levels() {
if len(log.Hooks[level]) != 1 {
t.Errorf("SyslogHook was not added. The length of log.Hooks[%v]: %v", level, len(log.Hooks[level]))
}
}
log.Info("Congratulations!")
}