-
Notifications
You must be signed in to change notification settings - Fork 1
/
defaults.go
48 lines (45 loc) · 1.37 KB
/
defaults.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
package log
import (
"github.com/imperfectgo/zap-syslog"
"github.com/imperfectgo/zap-syslog/syslog"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
const (
defaultLogFormatURI = "logger:json?outputPaths=stderr"
)
var (
baseLoggerLevel = zap.NewAtomicLevel()
defaultConsoleEncoderConfig = zapcore.EncoderConfig{
// Keys can be anything except the empty string.
TimeKey: "T",
LevelKey: "L",
NameKey: "N",
CallerKey: "C",
MessageKey: "M",
StacktraceKey: "S",
LineEnding: zapcore.DefaultLineEnding,
EncodeLevel: zapcore.CapitalColorLevelEncoder,
EncodeTime: zapcore.ISO8601TimeEncoder,
EncodeDuration: zapcore.StringDurationEncoder,
EncodeCaller: zapcore.ShortCallerEncoder,
}
defaultJSONEncoderConfig = zapcore.EncoderConfig{
TimeKey: "ts",
LevelKey: "level",
NameKey: "logger",
CallerKey: "caller",
MessageKey: "msg",
StacktraceKey: "stacktrace",
LineEnding: zapcore.DefaultLineEnding,
EncodeLevel: zapcore.LowercaseLevelEncoder,
EncodeTime: zapcore.EpochTimeEncoder,
EncodeDuration: zapcore.SecondsDurationEncoder,
EncodeCaller: zapcore.ShortCallerEncoder,
}
defaultSyslogEncoderConfig = zapsyslog.SyslogEncoderConfig{
EncoderConfig: defaultJSONEncoderConfig,
Framing: zapsyslog.DefaultFraming,
Facility: syslog.LOG_LOCAL0,
}
)