From b3c2513f445d1dd2e72d2dcba171a1ff28414ee8 Mon Sep 17 00:00:00 2001 From: dmachard <5562930+dmachard@users.noreply.github.com> Date: Tue, 9 Nov 2021 22:52:46 +0100 Subject: [PATCH] fix regression in stdout #8 --- loggers/stdout.go | 3 +-- loggers/syslog_test.go | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) 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