1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-09-23 02:49:49 +00:00
go-mtree/vendor/github.com/Sirupsen/logrus/hooks/syslog/syslog_test.go
Vincent Batts 50d22c5135 vendor: updating dependencies
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-06-24 14:45:05 -04:00

26 lines
539 B
Go

package logrus_syslog
import (
"github.com/sirupsen/logrus"
"log/syslog"
"testing"
)
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!")
}