-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.go
42 lines (35 loc) · 1.03 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
package logrusutil
const (
// DisabledLevel may be passed into a *Config struct
// to disable logging and discard output.
DisabledLevel = "disabled"
)
var (
// DefaultLevel is the default log level used in NewConfig()
DefaultLevel = "warning"
// DefaultHookLevel is the default level where hooks will
// contribute log messages.
DefaultHookLevel = "debug"
// DefaultHookStackLevel is the level at which the hook will
// apply.
DefaultHookStackLevel = 4
// DefaultCallerHookField sets the default field name that the
// CallerHook hook will apply to a log entry.
DefaultCallerHookField = "src"
)
// Config is used to provided configuration information
type Config struct {
Level string
HookLevel string
HookStackLevel int
CallerHookField string
}
// NewConfig produces a *Config struct with reasonable defaults.
func NewConfig() *Config {
return &Config{
Level: DefaultLevel,
HookLevel: DefaultHookLevel,
HookStackLevel: DefaultHookStackLevel,
CallerHookField: DefaultCallerHookField,
}
}