Skip to content

Commit

Permalink
Accept short aliases such as ts for timestamp
Browse files Browse the repository at this point in the history
CanHandle should return true also for lines having lvl, ts and message.
Last but not least '"' is optional, so message=oneword is ok.
  • Loading branch information
bettio committed Jun 10, 2019
1 parent 54cd1ed commit 9b6d86d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions logrus_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ func (h *LogrusHandler) clear() {

// CanHandle tells if this line can be handled by this handler.
func (h *LogrusHandler) CanHandle(d []byte) bool {
if !bytes.Contains(d, []byte(`level=`)) {
if !(bytes.Contains(d, []byte(`level=`)) || bytes.Contains(d, []byte(`lvl=`))) {
return false
}
if !bytes.Contains(d, []byte(`time="`)) {
if !(bytes.Contains(d, []byte(`time=`)) || bytes.Contains(d, []byte(`ts=`))) {
return false
}
if !bytes.Contains(d, []byte(`msg="`)) {
if !(bytes.Contains(d, []byte(`message=`)) || bytes.Contains(d, []byte(`msg=`))) {
return false
}
return true
Expand Down

0 comments on commit 9b6d86d

Please sign in to comment.