Skip to content

Commit

Permalink
parse time using supported time fields, not level fields...
Browse files Browse the repository at this point in the history
  • Loading branch information
aybabtme committed Dec 18, 2019
1 parent a97d727 commit 450ea4a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion json_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion logfmt_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 450ea4a

Please sign in to comment.