Skip to content

Commit

Permalink
Merge pull request #32 from lestrrat-go/makasimorg-custom-marshaller
Browse files Browse the repository at this point in the history
rebase #30
  • Loading branch information
lestrrat authored Sep 19, 2024
2 parents 2dfef78 + e382c1b commit 7bf975a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions buffered.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
// - fluent.WithJSONMarshaler
// - fluent.WithMaxConnAttempts
// - fluent.WithMsgpackMarshaler
// - fluent.WithMarshaller
// - fluent.WithNetwork
// - fluent.WithTagPrefix
// - fluent.WithWriteThreshold
Expand Down
6 changes: 4 additions & 2 deletions fluent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ func TestConnectOnStart(t *testing.T) {
// find a port that is not available (this may be timing dependent)
var dialer net.Dialer
port := 22412
for range 1000 {
//nolint:intrange
for i := 0; i < 1000; i++ {
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
conn, err := dialer.DialContext(ctx, `net`, fmt.Sprintf(`127.0.0.1:%d`, port))
cancel()
Expand Down Expand Up @@ -672,7 +673,8 @@ func TestPing(t *testing.T) {
// find a port that is not available (this may be timing dependent)
var dialer net.Dialer
port := 22412
for range 1000 {
//nolint:intrange
for i := 0; i < 1000; i++ {
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
conn, err := dialer.DialContext(ctx, `net`, fmt.Sprintf(`127.0.0.1:%d`, port))
cancel()
Expand Down
6 changes: 6 additions & 0 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func WithJSONMarshaler() Option {
return option.New(identMarshaler{}, marshalFunc(jsonMarshal))
}

// WithMarshaller specifies a custom marshaling to be used when
// sending messages to fluentd. Used for `fluent.New`
func WithMarshaller(m marshaler) Option {
return option.New(identMarshaler{}, m)
}

// WithMsgpackMarshaler specifies msgpack marshaling to be used when
// sending messages to fluentd. Used in `fluent.New`
func WithMsgpackMarshaler() Option {
Expand Down

0 comments on commit 7bf975a

Please sign in to comment.