diff options
author | 2018-01-04 08:44:00 +0000 | |
---|---|---|
committer | 2018-01-04 08:44:00 +0000 | |
commit | 35fd2cc86d442dee6fa4c8adb46a6e4906a66ab3 (patch) | |
tree | cf5c057ee0aeb769c683368f1f391dacafd1d671 /vendor/github.com/sirupsen/logrus/hooks/syslog/syslog_test.go | |
parent | 8b44355205182f6042b0691fa31fb8aafcefb42d (diff) | |
parent | ac6019137d5b10d02c7acac4f63fa22091b9933d (diff) |
Merge "Fix imports for github.com/sirupsen/logrus"
Diffstat (limited to 'vendor/github.com/sirupsen/logrus/hooks/syslog/syslog_test.go')
-rw-r--r-- | vendor/github.com/sirupsen/logrus/hooks/syslog/syslog_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/github.com/sirupsen/logrus/hooks/syslog/syslog_test.go b/vendor/github.com/sirupsen/logrus/hooks/syslog/syslog_test.go new file mode 100644 index 0000000..8d7fbe4 --- /dev/null +++ b/vendor/github.com/sirupsen/logrus/hooks/syslog/syslog_test.go @@ -0,0 +1,26 @@ +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!") +} |