mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Update log/handler.go
Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
parent
3e11e89d57
commit
bd684ceac7
1 changed files with 2 additions and 3 deletions
|
|
@ -197,9 +197,8 @@ func LogfmtHandlerWithLevel(wr io.Writer, level slog.Level) slog.Handler {
|
||||||
func builtinReplace(_ []string, attr slog.Attr) slog.Attr {
|
func builtinReplace(_ []string, attr slog.Attr) slog.Attr {
|
||||||
switch attr.Key {
|
switch attr.Key {
|
||||||
case slog.TimeKey:
|
case slog.TimeKey:
|
||||||
if t, ok := attr.Value.Any().(time.Time); ok {
|
if attr.Value.Kind() == slog.KindTime {
|
||||||
attr = slog.Any("t", t.Format(timeFormat))
|
return slog.Time("t", attr.Value.Time())
|
||||||
return attr
|
|
||||||
}
|
}
|
||||||
case slog.LevelKey:
|
case slog.LevelKey:
|
||||||
if l, ok := attr.Value.Any().(slog.Level); ok {
|
if l, ok := attr.Value.Any().(slog.Level); ok {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue