-
Notifications
You must be signed in to change notification settings - Fork 1
/
option.go
143 lines (121 loc) · 2.79 KB
/
option.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package ali
import (
"time"
"go.uber.org/zap/zapcore"
)
// Option 可选项
type Option func(c *config)
// WithEncoder ...
func WithEncoder(enc zapcore.Encoder) Option {
return func(c *config) {
c.encoder = enc
}
}
// WithEndpoint ...
func WithEndpoint(endpoint string) Option {
return func(c *config) {
c.endpoint = endpoint
}
}
// WithAccessKeyID ...
func WithAccessKeyID(akID string) Option {
return func(c *config) {
c.accessKeyID = akID
}
}
// WithAccessKeySecret ....
func WithAccessKeySecret(akSecret string) Option {
return func(c *config) {
c.accessKeySecret = akSecret
}
}
// WithProject ...
func WithProject(project string) Option {
return func(c *config) {
c.project = project
}
}
// WithLogstore ...
func WithLogstore(logStore string) Option {
return func(c *config) {
c.logstore = logStore
}
}
// WithMaxQueueSize ...
func WithMaxQueueSize(maxQueueSize int) Option {
return func(c *config) {
c.maxQueueSize = maxQueueSize
}
}
// WithLevelEnabler ...
func WithLevelEnabler(lv zapcore.LevelEnabler) Option {
return func(c *config) {
c.levelEnabler = lv
}
}
// WithFlushBufferSize ...
func WithFlushBufferSize(flushBufferSize int) Option {
return func(c *config) {
c.flushBufferSize = int32(flushBufferSize)
}
}
// WithFlushBufferInterval ...
func WithFlushBufferInterval(flushBufferInterval time.Duration) Option {
return func(c *config) {
c.flushBufferInterval = flushBufferInterval
}
}
// WithAPIBulkSize ...
func WithAPIBulkSize(apiBulkSize int) Option {
return func(c *config) {
c.apiBulkSize = apiBulkSize
}
}
// WithAPITimeout ...
func WithAPITimeout(apiTimeout time.Duration) Option {
return func(c *config) {
c.apiTimeout = apiTimeout
}
}
// WithAPIRetryCount ...
func WithAPIRetryCount(apiRetryCount int) Option {
return func(c *config) {
c.apiRetryCount = apiRetryCount
}
}
// WithAPIRetryWaitTime ...
func WithAPIRetryWaitTime(apiRetryWaitTime time.Duration) Option {
return func(c *config) {
c.apiRetryWaitTime = apiRetryWaitTime
}
}
// WithAPIRetryMaxWaitTime ...
func WithAPIRetryMaxWaitTime(apiRetryMaxWaitTime time.Duration) Option {
return func(c *config) {
c.apiRetryMaxWaitTime = apiRetryMaxWaitTime
}
}
// WithAPIMaxIdleConns ...
func WithAPIMaxIdleConns(apiMaxIdleConns int) Option {
return func(c *config) {
c.apiMaxIdleConns = apiMaxIdleConns
}
}
// WithAPIIdleConnTimeout ...
func WithAPIIdleConnTimeout(apiIdleConnTimeout time.Duration) Option {
return func(c *config) {
c.apiIdleConnTimeout = apiIdleConnTimeout
}
}
// WithAPIMaxIdleConnsPerHost ...
func WithAPIMaxIdleConnsPerHost(apiMaxIdleConnsPerHost int) Option {
return func(c *config) {
c.apiMaxIdleConnsPerHost = apiMaxIdleConnsPerHost
}
}
// WithFallbackCore ...
func WithFallbackCore(core zapcore.Core) Option {
return func(c *config) {
c.fallbackCore = core
}
}