-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b50871
commit 76779e7
Showing
4 changed files
with
190 additions
and
45 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,53 @@ | ||
package logrus_fluent | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/fluent/fluent-logger-golang/fluent" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
// Config is settings for FluentHook. | ||
type Config struct { | ||
Port int | ||
Host string | ||
LogLevels []logrus.Level | ||
DisableConnectionPool bool // Fluent client will be created every logging if true. | ||
DefaultTag string | ||
DefaultMessageField string | ||
DefaultIgnoreFields map[string]struct{} | ||
DefaultFilters map[string]func(interface{}) interface{} | ||
|
||
// from fluent.Config | ||
// see https://github.com/fluent/fluent-logger-golang/blob/master/fluent/fluent.go | ||
FluentNetwork string | ||
FluentSocketPath string | ||
Timeout time.Duration | ||
WriteTimeout time.Duration | ||
BufferLimit int | ||
RetryWait int | ||
MaxRetry int | ||
TagPrefix string | ||
AsyncConnect bool | ||
MarshalAsJSON bool | ||
SubSecondPrecision bool | ||
} | ||
|
||
// FluentConfig converts data to fluent.Config. | ||
func (c Config) FluentConfig() fluent.Config { | ||
return fluent.Config{ | ||
FluentPort: c.Port, | ||
FluentHost: c.Host, | ||
FluentNetwork: c.FluentNetwork, | ||
FluentSocketPath: c.FluentSocketPath, | ||
Timeout: c.Timeout, | ||
WriteTimeout: c.WriteTimeout, | ||
BufferLimit: c.BufferLimit, | ||
RetryWait: c.RetryWait, | ||
MaxRetry: c.MaxRetry, | ||
TagPrefix: c.TagPrefix, | ||
AsyncConnect: c.AsyncConnect, | ||
MarshalAsJSON: c.MarshalAsJSON, | ||
SubSecondPrecision: c.SubSecondPrecision, | ||
} | ||
} |
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