(t *testing.T)
| 290 | } |
| 291 | |
| 292 | func TestWithFieldShouldNotOverrideTime(t *testing.T) { |
| 293 | now := time.Now().Add(24 * time.Hour) |
| 294 | |
| 295 | LogAndAssertJSON(t, func(log *Logger) { |
| 296 | log.WithTime(now).WithField("herp", "derp").Info("blah") |
| 297 | }, func(fields Fields) { |
| 298 | assert.Equal(t, now.Format(time.RFC3339), fields["time"]) |
| 299 | assert.Equal(t, "derp", fields["herp"]) |
| 300 | }) |
| 301 | } |
| 302 | |
| 303 | func TestTimeOverrideMultipleLogs(t *testing.T) { |
| 304 | var buffer bytes.Buffer |