From 02d7ce57c245d07bf7a5e8692f23001c3405bc31 Mon Sep 17 00:00:00 2001 From: Denis Machard <5562930+dmachard@users.noreply.github.com> Date: Tue, 14 May 2024 20:54:08 +0200 Subject: [PATCH] update makefile deps (#709) remote uneeded code in syslog --- Makefile | 6 +++--- workers/syslog.go | 41 ++--------------------------------------- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 4c15b90e..662ae465 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,10 @@ BINARY_NAME := go-dnscollector GO_VERSION := $(shell go env GOVERSION | sed -n 's/go\([0-9]\+\.[0-9]\+\).*/\1/p') GO_LOGGER := 0.4.0 -GO_POWERDNS_PROTOBUF := 1.1.0 -GO_DNSTAP_PROTOBUF := 1.0.0 +GO_POWERDNS_PROTOBUF := 1.1.1 +GO_DNSTAP_PROTOBUF := 1.0.1 GO_FRAMESTREAM := 0.10.0 -GO_CLIENTSYSLOG := 0.3.0 +GO_CLIENTSYSLOG := 0.4.0 GO_TOPMAP := 1.0.0 BUILD_TIME := $(shell LANG=en_US date +"%F_%T_%z") diff --git a/workers/syslog.go b/workers/syslog.go index ca9d8f14..d14e2a7d 100644 --- a/workers/syslog.go +++ b/workers/syslog.go @@ -4,7 +4,6 @@ import ( "bytes" "crypto/tls" "encoding/json" - "fmt" "time" "strings" @@ -19,42 +18,6 @@ import ( "github.com/dmachard/go-logger" ) -func GetPriority(facility string) (syslog.Priority, error) { - facility = strings.ToUpper(facility) - switch facility { - // level - case "WARNING": - return syslog.LOG_WARNING, nil - case "NOTICE": - return syslog.LOG_NOTICE, nil - case "INFO": - return syslog.LOG_INFO, nil - case "DEBUG": - return syslog.LOG_DEBUG, nil - // facility - case "DAEMON": - return syslog.LOG_DAEMON, nil - case "LOCAL0": - return syslog.LOG_LOCAL0, nil - case "LOCAL1": - return syslog.LOG_LOCAL1, nil - case "LOCAL2": - return syslog.LOG_LOCAL2, nil - case "LOCAL3": - return syslog.LOG_LOCAL3, nil - case "LOCAL4": - return syslog.LOG_LOCAL4, nil - case "LOCAL5": - return syslog.LOG_LOCAL5, nil - case "LOCAL6": - return syslog.LOG_LOCAL6, nil - case "LOCAL7": - return syslog.LOG_LOCAL7, nil - default: - return 0, fmt.Errorf("invalid syslog priority: %s", facility) - } -} - type Syslog struct { *pkgutils.GenericWorker severity, facility syslog.Priority @@ -80,13 +43,13 @@ func (w *Syslog) ReadConfig() { if !pkgconfig.IsValidMode(w.GetConfig().Loggers.Syslog.Mode) { w.LogFatal(pkgutils.PrefixLogWorker + "invalid mode text or json expected") } - severity, err := GetPriority(w.GetConfig().Loggers.Syslog.Severity) + severity, err := syslog.GetPriority(w.GetConfig().Loggers.Syslog.Severity) if err != nil { w.LogFatal(pkgutils.PrefixLogWorker + "invalid severity") } w.severity = severity - facility, err := GetPriority(w.GetConfig().Loggers.Syslog.Facility) + facility, err := syslog.GetPriority(w.GetConfig().Loggers.Syslog.Facility) if err != nil { w.LogFatal(pkgutils.PrefixLogWorker + "invalid facility") }