Skip to content

Commit

Permalink
Merge pull request #5 from ElrondfromRussia/main
Browse files Browse the repository at this point in the history
port type fix
  • Loading branch information
ElrondfromRussia authored Oct 12, 2021
2 parents c9cf7e1 + 9cee898 commit 3dadcca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions sysloger.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (

// Syslog dial params
type SyslogParams struct {
Level int `json:"level"` // syslog level info/error/fatal
Host string `json:"host"` // host to send
Port interface{} `json:"port"` // port to send
Protocol string `json:"protocol"` // tcp\udp
Level int `json:"level"` // syslog level info/error/fatal
Host string `json:"host"` // host to send
Port int `json:"port"` // port to send
Protocol string `json:"protocol"` // tcp\udp

Priority syslog.Priority
Tag string `json:"tag"` // syslog tag
Expand All @@ -41,10 +41,10 @@ func NewSyslogWriter(params SyslogParams, formatter syslog.Formatter) (*syslog.W
}

sysLogger, err = syslog.DialWithTLSConfig(params.Protocol,
fmt.Sprintf("%s:%s", params.Host, params.Port), params.Priority, params.Tag, params.TlsConf)
fmt.Sprintf("%s:%d", params.Host, params.Port), params.Priority, params.Tag, params.TlsConf)
} else {
sysLogger, err = syslog.Dial(params.Protocol,
fmt.Sprintf("%s:%s", params.Host, params.Port), params.Priority, params.Tag)
fmt.Sprintf("%s:%d", params.Host, params.Port), params.Priority, params.Tag)
}

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions sysloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestSendSingleSyslogMsg(t *testing.T) {
err = SendSingleSyslogMsg(SyslogParams{
Level: 5,
Host: "127.0.0.1",
Port: "555",
Port: 555,
Protocol: "tcp",
Priority: 0,
Tag: "test",
Expand Down Expand Up @@ -115,7 +115,7 @@ func TestSendListToSyslog(t *testing.T) {
err := SendListToSyslog(SyslogParams{
Level: 3,
Host: "127.0.0.1",
Port: "555",
Port: 555,
Protocol: "tcp",
Priority: 0,
Tag: "test",
Expand Down

0 comments on commit 3dadcca

Please sign in to comment.