forked from mirror/logrus
go fmt
This commit is contained in:
parent
5c909080d7
commit
ffc6dc63ef
|
@ -1,17 +1,17 @@
|
||||||
package logrus_syslog
|
package logrus_syslog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/syslog"
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
|
"log/syslog"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SyslogHook to send logs via syslog.
|
// SyslogHook to send logs via syslog.
|
||||||
type SyslogHook struct{
|
type SyslogHook struct {
|
||||||
Writer *syslog.Writer
|
Writer *syslog.Writer
|
||||||
SyslogNetwork string
|
SyslogNetwork string
|
||||||
SyslogRaddr string
|
SyslogRaddr string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a hook to be added to an instance of logger. This is called with
|
// Creates a hook to be added to an instance of logger. This is called with
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package logrus_syslog
|
package logrus_syslog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
|
||||||
"log/syslog"
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
|
"log/syslog"
|
||||||
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLocalhostAddAndPrint(t *testing.T) {
|
func TestLocalhostAddAndPrint(t *testing.T) {
|
||||||
log := logrus.New()
|
log := logrus.New()
|
||||||
hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
|
hook, err := NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Unable to connect to local syslog.")
|
t.Errorf("Unable to connect to local syslog.")
|
||||||
|
@ -23,4 +23,4 @@ func TestLocalhostAddAndPrint(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Congratulations!")
|
log.Info("Congratulations!")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue