diff --git a/loggers/stdout.go b/loggers/stdout.go index 3dbf9da1..8fd098af 100644 --- a/loggers/stdout.go +++ b/loggers/stdout.go @@ -15,7 +15,6 @@ import ( type StdOut struct { done chan bool channel chan dnsutils.DnsMessage - mode string textFormat []string config *dnsutils.Config logger *logger.Logger @@ -76,7 +75,7 @@ func (o *StdOut) Run() { buffer := new(bytes.Buffer) for dm := range o.channel { - switch o.mode { + switch o.config.Loggers.Stdout.Mode { case "text": o.stdout.Print(dm.String(o.textFormat)) case "json": diff --git a/loggers/syslog_test.go b/loggers/syslog_test.go index 8f99f882..777a8ee8 100644 --- a/loggers/syslog_test.go +++ b/loggers/syslog_test.go @@ -10,11 +10,12 @@ import ( "github.com/dmachard/go-logger" ) -func TestSyslogRun(t *testing.T) { +func TestSyslogRunTextMode(t *testing.T) { // init logger config := dnsutils.GetFakeConfig() config.Loggers.Syslog.Transport = "tcp" config.Loggers.Syslog.RemoteAddress = ":4000" + config.Loggers.Syslog.Mode = "text" g := NewSyslog(config, logger.New(false)) // fake json receiver