7742183cd4
Vendor golang.org/x/sys to get the UtimesNanoAt function defined for all unix-like OSes. The function will be used in a successive commit. This also re-vendors the other dependencies from glide.yaml. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
27 lines
533 B
Go
27 lines
533 B
Go
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!")
|
|
}
|