Skip to content

Commit

Permalink
Merge pull request #13 from soldiermoth/allow-message-key
Browse files Browse the repository at this point in the history
Allow 'message' to be used as the message key instead of 'msg'
  • Loading branch information
aybabtme authored Jun 16, 2017
2 parents cda9ae1 + bdda93f commit d83d791
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions json_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ func (h *JSONHandler) UnmarshalJSON(data []byte) error {
h.Time = time.Unix(int64(f), int64((f-float64(int64(f)))*1000000000))
delete(raw, "ts")
}
h.Message, _ = raw["msg"].(string)
delete(raw, "msg")
if h.Message, ok = raw["msg"].(string); ok {
delete(raw, "msg")
} else if h.Message, ok = raw["message"].(string); ok {
delete(raw, "message")
}

h.Level, ok = raw["level"].(string)
if !ok {
Expand Down

0 comments on commit d83d791

Please sign in to comment.