diff --git a/buffered.go b/buffered.go index 5fc6dac..8eed164 100644 --- a/buffered.go +++ b/buffered.go @@ -11,16 +11,17 @@ import ( // NewBuffered creates a new Buffered client. // Options may be one of the following: // -// * fluent.WithAddress -// * fluent.WithBufferLimit -// * fluent.WithDialTimeout -// * fluent.WithJSONMarshaler -// * fluent.WithMaxConnAttempts -// * fluent.WithMsgpackMarshaler -// * fluent.WithNetwork -// * fluent.WithTagPrefix -// * fluent.WithWriteThreshold -// * fluent.WithWriteQueueSize +// - fluent.WithAddress +// - fluent.WithBufferLimit +// - fluent.WithDialTimeout +// - fluent.WithJSONMarshaler +// - fluent.WithMaxConnAttempts +// - fluent.WithMsgpackMarshaler +// - fluent.WithMarshaller +// - fluent.WithNetwork +// - fluent.WithTagPrefix +// - fluent.WithWriteThreshold +// - fluent.WithWriteQueueSize // // Please see their respective documentation for details. func NewBuffered(options ...Option) (client *Buffered, err error) { @@ -62,17 +63,16 @@ func NewBuffered(options ...Option) (client *Buffered, err error) { // If you would like to specify options to `Post()`, you may pass them at the end of // the method. Currently you can use the following: // -// fluent.WithContext: specify context.Context to use -// fluent.WithTimestamp: allows you to set arbitrary timestamp values -// fluent.WithSyncAppend: allows you to verify if the append was successful +// fluent.WithContext: specify context.Context to use +// fluent.WithTimestamp: allows you to set arbitrary timestamp values +// fluent.WithSyncAppend: allows you to verify if the append was successful // // If fluent.WithSyncAppend is provide and is true, the following errors // may be returned: // -// 1. If the current underlying pending buffer is is not large enough to -// hold this new data, an error will be returned -// 2. If the marshaling into msgpack/json failed, it is returned -// +// 1. If the current underlying pending buffer is is not large enough to +// hold this new data, an error will be returned +// 2. If the marshaling into msgpack/json failed, it is returned func (c *Buffered) Post(tag string, v interface{}, options ...Option) (err error) { if pdebug.Enabled { g := pdebug.Marker("fluent.Buffered.Post").BindError(&err) diff --git a/options.go b/options.go index 7b8c383..12fd3cf 100644 --- a/options.go +++ b/options.go @@ -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 {