This repository has been archived by the owner on May 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: Generic best effort option for syslog parsers
- Loading branch information
Showing
2 changed files
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
package syslog | ||
|
||
// WithListener returns a generic option for syslog parsers. | ||
// 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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters