Skip to content

Commit

Permalink
Merge pull request #31 from aybabtme/fix-time-parsing
Browse files Browse the repository at this point in the history
parse time using supported time fields, not level fields...
  • Loading branch information
aybabtme authored Dec 18, 2019
2 parents a97d727 + 450ea4a commit f0655c5
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 f0655c5

Please sign in to comment.