72ac04e7ca
With: $ git mv vendor/github.com/{S,s}irupsen $ sed -i 's/Sirupsen/sirupsen/g' $(git grep -l Sirupsen) catching up with the upstream lowercasing [1,2,3,4]. Because of the compatibility issues discussed in [3], some consumers may prefer to use the old uppercase version until they have time to update their other Logrus consumers to the new lowercase form. [1]: https://github.com/sirupsen/logrus/blame/v1.0.3/README.md#L6 [2]: https://github.com/sirupsen/logrus/pull/384 [3]: https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276 [4]: https://github.com/sirupsen/logrus/issues/553
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!")
|
|
}
|