Make loggers io.Writer implementations, not directly lumberjack objects

This commit is contained in:
Frank Denis 2020-07-08 11:36:58 +02:00
parent 7bec554709
commit 10710def50
5 changed files with 10 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"io"
"net" "net"
"strings" "strings"
"time" "time"
@ -16,7 +17,7 @@ import (
type PluginBlockIP struct { type PluginBlockIP struct {
blockedPrefixes *iradix.Tree blockedPrefixes *iradix.Tree
blockedIPs map[string]interface{} blockedIPs map[string]interface{}
logger *lumberjack.Logger logger io.Writer
format string format string
} }

View File

@ -3,6 +3,7 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"io"
"net" "net"
"strings" "strings"
"time" "time"
@ -16,7 +17,7 @@ import (
type BlockedNames struct { type BlockedNames struct {
allWeeklyRanges *map[string]WeeklyRanges allWeeklyRanges *map[string]WeeklyRanges
patternMatcher *PatternMatcher patternMatcher *PatternMatcher
logger *lumberjack.Logger logger io.Writer
format string format string
} }

View File

@ -3,6 +3,7 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"io"
"net" "net"
"time" "time"
@ -12,7 +13,7 @@ import (
) )
type PluginNxLog struct { type PluginNxLog struct {
logger *lumberjack.Logger logger io.Writer
format string format string
} }

View File

@ -3,6 +3,7 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"io"
"net" "net"
"strings" "strings"
"time" "time"
@ -13,7 +14,7 @@ import (
) )
type PluginQueryLog struct { type PluginQueryLog struct {
logger *lumberjack.Logger logger io.Writer
format string format string
ignoredQtypes []string ignoredQtypes []string
} }

View File

@ -3,6 +3,7 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"io"
"net" "net"
"strings" "strings"
"time" "time"
@ -16,7 +17,7 @@ import (
type PluginWhitelistName struct { type PluginWhitelistName struct {
allWeeklyRanges *map[string]WeeklyRanges allWeeklyRanges *map[string]WeeklyRanges
patternMatcher *PatternMatcher patternMatcher *PatternMatcher
logger *lumberjack.Logger logger io.Writer
format string format string
} }