(t *testing.T)
| 151 | } |
| 152 | |
| 153 | func TestNoEncodeLevelSupplied(t *testing.T) { |
| 154 | enc := zapcore.NewJSONEncoder(zapcore.EncoderConfig{ |
| 155 | MessageKey: "M", |
| 156 | LevelKey: "L", |
| 157 | TimeKey: "T", |
| 158 | NameKey: "N", |
| 159 | CallerKey: "C", |
| 160 | FunctionKey: "F", |
| 161 | StacktraceKey: "S", |
| 162 | EncodeTime: zapcore.ISO8601TimeEncoder, |
| 163 | EncodeDuration: zapcore.SecondsDurationEncoder, |
| 164 | EncodeCaller: zapcore.ShortCallerEncoder, |
| 165 | }) |
| 166 | |
| 167 | ent := zapcore.Entry{ |
| 168 | Level: zapcore.InfoLevel, |
| 169 | Time: time.Date(2018, 6, 19, 16, 33, 42, 99, time.UTC), |
| 170 | LoggerName: "bob", |
| 171 | Message: "lob law", |
| 172 | } |
| 173 | |
| 174 | fields := []zapcore.Field{ |
| 175 | zap.Int("answer", 42), |
| 176 | } |
| 177 | |
| 178 | _, err := enc.EncodeEntry(ent, fields) |
| 179 | assert.NoError(t, err, "Unexpected JSON encoding error.") |
| 180 | } |
| 181 | |
| 182 | func TestJSONEmptyConfig(t *testing.T) { |
| 183 | tests := []struct { |
nothing calls this directly
no test coverage detected