forked from influxdata/go-syslog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.go
More file actions
27 lines (24 loc) · 728 Bytes
/
Copy pathoptions.go
File metadata and controls
27 lines (24 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package syslog
// WithListener returns a generic option that sets the emit function for syslog parsers.
func WithListener(f ParserListener) ParserOption {
return func(p Parser) Parser {
p.WithListener(f)
return p
}
}
// WithBestEffort returns a generic options that enables best effort mode for syslog parsers.
//
// When passed to a parser it tries to recover as much of the syslog messages as possible.
func WithBestEffort() ParserOption {
return func(p Parser) Parser {
p.WithBestEffort()
return p
}
}
// WithMaxMessageLength sets the length of the buffer for octect parsing.
func WithMaxMessageLength(length int) ParserOption {
return func(p Parser) Parser {
p.WithMaxMessageLength(length)
return p
}
}