From 450ea4a8ec2f6f193455b23cb369a911edcd5473 Mon Sep 17 00:00:00 2001 From: Antoine Grondin Date: Wed, 18 Dec 2019 10:30:53 +0900 Subject: [PATCH] parse time using supported time fields, not level fields... --- json_handler.go | 2 +- logfmt_handler.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/json_handler.go b/json_handler.go index cca12c3..723512f 100644 --- a/json_handler.go +++ b/json_handler.go @@ -75,7 +75,7 @@ func (h *JSONHandler) UnmarshalJSON(data []byte) bool { return false } - checkEachUntilFound(supportedLevelFields, func(field string) bool { + checkEachUntilFound(supportedTimeFields, func(field string) bool { time, ok := tryParseTime(raw[field]) if ok { h.Time = time diff --git a/logfmt_handler.go b/logfmt_handler.go index a8df100..10223dd 100644 --- a/logfmt_handler.go +++ b/logfmt_handler.go @@ -62,7 +62,7 @@ func (h *LogfmtHandler) UnmarshalLogfmt(data []byte) bool { key := dec.Key() val := dec.Value() if h.Time.IsZero() { - foundTime := checkEachUntilFound(supportedLevelFields, func(field string) bool { + foundTime := checkEachUntilFound(supportedTimeFields, func(field string) bool { time, ok := tryParseTime(string(val)) if ok { h.Time = time