fix logfmt time field value formatting

This commit is contained in:
Jared Wasinger 2023-11-14 21:22:45 +08:00
parent b61bbbfd0f
commit 655e6fc1fd

View file

@ -177,7 +177,7 @@ func builtinReplace(_ []string, attr slog.Attr) slog.Attr {
switch attr.Key {
case slog.TimeKey:
if attr.Value.Kind() == slog.KindTime {
return slog.Time("t", attr.Value.Time())
return slog.Any("t", attr.Value.Time().Format(timeFormat))
}
case slog.LevelKey:
if l, ok := attr.Value.Any().(slog.Level); ok {