Skip to content

Commit

Permalink
fix bug, when scanner fails to parse logfmt, print log entry
Browse files Browse the repository at this point in the history
  • Loading branch information
aybabtme committed Nov 5, 2014
1 parent 473621e commit f5c17a6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added release/0.1.2/humanlog_darwin_amd64.tar.gz
Binary file not shown.
Binary file added release/0.1.2/humanlog_linux_amd64.tar.gz
Binary file not shown.
9 changes: 7 additions & 2 deletions scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package humanlog

import (
"bufio"
"github.com/kr/logfmt"
"io"
"log"

"github.com/kr/logfmt"
)

var eol = [...]byte{'\n'}
var (
eol = [...]byte{'\n'}
)

// Scanner reads logfmt'd lines from src and prettify them onto dst.
// If the lines aren't logfmt, it will simply write them out with no
Expand All @@ -31,6 +34,8 @@ func Scanner(src io.Reader, dst io.Writer, opts *HandlerOptions) error {
err := logfmt.Unmarshal(lineData, &logrusEntry)
if err != nil {
log.Printf("line %d: parsing logfmt, %v", line, err)
lastLogrus = false
dst.Write(lineData)
continue
}
dst.Write(logrusEntry.Prettify(opts.SkipUnchanged && lastLogrus))
Expand Down

0 comments on commit f5c17a6

Please sign in to comment.