Skip to content

Commit

Permalink
update makefile deps (#709)
Browse files Browse the repository at this point in the history
remote uneeded code in syslog
  • Loading branch information
dmachard authored May 14, 2024
1 parent b1f0490 commit 02d7ce5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 42 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
41 changes: 2 additions & 39 deletions workers/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"time"

"strings"
Expand All @@ -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
Expand All @@ -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")
}
Expand Down

0 comments on commit 02d7ce5

Please sign in to comment.