File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,13 @@ func Encoder(encoder zapcore.Encoder) func(o *Options) {
71
71
}
72
72
}
73
73
74
+ // JSONEncoder configures the logger to use a JSON Encoder
75
+ func JSONEncoder (opts ... EncoderConfigOption ) func (o * Options ) {
76
+ return func (o * Options ) {
77
+ o .Encoder = newJSONEncoder (opts ... )
78
+ }
79
+ }
80
+
74
81
func newJSONEncoder (opts ... EncoderConfigOption ) zapcore.Encoder {
75
82
encoderConfig := zap .NewProductionEncoderConfig ()
76
83
for _ , opt := range opts {
@@ -79,6 +86,13 @@ func newJSONEncoder(opts ...EncoderConfigOption) zapcore.Encoder {
79
86
return zapcore .NewJSONEncoder (encoderConfig )
80
87
}
81
88
89
+ // ConsoleEncoder configures the logger to use a Console encoder
90
+ func ConsoleEncoder (opts ... EncoderConfigOption ) func (o * Options ) {
91
+ return func (o * Options ) {
92
+ o .Encoder = newConsoleEncoder (opts ... )
93
+ }
94
+ }
95
+
82
96
func newConsoleEncoder (opts ... EncoderConfigOption ) zapcore.Encoder {
83
97
encoderConfig := zap .NewDevelopmentEncoderConfig ()
84
98
for _ , opt := range opts {
You can’t perform that action at this time.
0 commit comments