Skip to content

Commit

Permalink
Fix bug in default time format
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo Willows committed Jan 21, 2025
1 parent 9706aeb commit 58c5be9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

const (
// DefaultTimeFormat is the default format for any [time.Time] logged.
DefaultTimeFormat = "2006-01-02T15:04:05,000Z07:00"
DefaultTimeFormat = "2006-01-02T15:04:05,999Z07:00"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestHandler(t *testing.T) {
slog.Int("int", -123_456),
slog.Int64("int64", 42),
slog.String("string", "a string"),
slog.Time("time", time.Date(2000, 1, 2, 3, 4, 5, 6, time.UTC)),
slog.Time("time", time.Date(2000, 1, 2, 3, 4, 5, 6, time.UTC).Add(123_456*time.Microsecond)),
slog.Uint64("uint64", 123456),
},
Patterns: []string{
Expand All @@ -57,7 +57,7 @@ func TestHandler(t *testing.T) {
`\sint=-123,456\b`,
`\sline=\d+\b\b`,
`\sstring=a string\b`,
`\stime=2000-01-02T03:04:05,000Z\b`,
`\stime=2000-01-02T03:04:05,123Z\b`,
`\suint64=123,456\b`,
},
},
Expand Down

0 comments on commit 58c5be9

Please sign in to comment.