-
Notifications
You must be signed in to change notification settings - Fork 22
/
config.go
55 lines (50 loc) · 1.56 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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
RequestAck 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,
Async: c.AsyncConnect,
MarshalAsJSON: c.MarshalAsJSON,
SubSecondPrecision: c.SubSecondPrecision,
RequestAck: c.RequestAck,
}
}