-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Logstash appender to use io.Writer (#57)
Change Logstash appender to use simpler io.Writer interface instead of an extensive net.Conn interface, whose functions were not needed at all. This allows the use of decorators from the xio package (added an example of their usage).
- Loading branch information
Showing
4 changed files
with
65 additions
and
31 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package appender_test | ||
|
||
import ( | ||
"log" | ||
"net" | ||
|
||
"github.com/allegro/mesos-executor/servicelog/appender" | ||
) | ||
|
||
func ExampleNewLogstash() { | ||
// create writer that will be used to send logs | ||
writer, err := net.DialUDP("udp", nil, nil) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// create appender with desired options | ||
_, err = appender.NewLogstash(writer, | ||
appender.LogstashRateLimit(100), | ||
appender.LogstashSizeLimit(16000)) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
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
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