Skip to content

Commit e98b8fb

Browse files
Move compression settings to UDPWriter and run go fmt
1 parent b5ee25b commit e98b8fb

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

gelf/tcpwriter.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@ import (
99
)
1010

1111
const (
12-
DefaultMaxReconnect = 3
12+
DefaultMaxReconnect = 3
1313
DefaultReconnectDelay = 1
1414
)
1515

1616
type TCPWriter struct {
1717
GelfWriter
18-
mu sync.Mutex
19-
MaxReconnect int
18+
mu sync.Mutex
19+
MaxReconnect int
2020
ReconnectDelay time.Duration
2121
}
2222

2323
func NewTCPWriter(addr string) (*TCPWriter, error) {
2424
var err error
2525
w := new(TCPWriter)
26-
w.CompressionType = CompressNone
2726
w.MaxReconnect = DefaultMaxReconnect
2827
w.ReconnectDelay = DefaultReconnectDelay
2928
w.proto = "tcp"

gelf/udpwriter.go

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020

2121
type UDPWriter struct {
2222
GelfWriter
23+
CompressionLevel int // one of the consts from compress/flate
24+
CompressionType CompressType
2325
}
2426

2527
// What compression type the writer should use when sending messages

gelf/writer.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ type Writer interface {
1818
// messages to a graylog2 server, or data from a stream-oriented
1919
// interface (like the functions in log).
2020
type GelfWriter struct {
21-
addr string
22-
conn net.Conn
23-
hostname string
24-
Facility string // defaults to current process name
25-
proto string
26-
CompressionLevel int // one of the consts from compress/flate
27-
CompressionType CompressType
21+
addr string
22+
conn net.Conn
23+
hostname string
24+
Facility string // defaults to current process name
25+
proto string
2826
}
2927

3028
// Close connection and interrupt blocked Read or Write operations

0 commit comments

Comments
 (0)