This commit is contained in:
Didip Kerabat 2014-07-27 22:01:56 -07:00
parent 5c909080d7
commit ffc6dc63ef
2 changed files with 11 additions and 11 deletions

View File

@ -1,17 +1,17 @@
package logrus_syslog
import (
"os"
"fmt"
"log/syslog"
"github.com/Sirupsen/logrus"
"log/syslog"
"os"
)
// SyslogHook to send logs via syslog.
type SyslogHook struct{
Writer *syslog.Writer
SyslogNetwork string
SyslogRaddr string
type SyslogHook struct {
Writer *syslog.Writer
SyslogNetwork string
SyslogRaddr string
}
// Creates a hook to be added to an instance of logger. This is called with

View File

@ -1,14 +1,14 @@
package logrus_syslog
import (
"testing"
"log/syslog"
"github.com/Sirupsen/logrus"
"log/syslog"
"testing"
)
func TestLocalhostAddAndPrint(t *testing.T) {
log := logrus.New()
hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
log := logrus.New()
hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
if err != nil {
t.Errorf("Unable to connect to local syslog.")
@ -23,4 +23,4 @@ func TestLocalhostAddAndPrint(t *testing.T) {
}
log.Info("Congratulations!")
}
}