Permalink
Browse files

Merge pull request #1 from mikep/master

Don't die on log lines that aren't JSON.
  • Loading branch information...
2 parents de7dfae + 88a4d3b commit 0fb283dbb93746466b1760299a20b275417846fb @hoytech committed Aug 3, 2013
Showing with 9 additions and 2 deletions.
  1. +9 −2 bin/log-defer-viz
View
@@ -6,6 +6,7 @@ use JSON::XS;
use Getopt::Long;
use Term::ANSIColor;
use Term::Size;
+use Try::Tiny;
use Log::Defer::Viz;
@@ -143,8 +144,14 @@ while (my $file = shift) {
}
while(<$fh>) {
- my $entry = decode_json($_);
- handle_entry($entry);
+ try {
+ my $entry = decode_json($_);
+ handle_entry($entry);
+ } catch {
+ if ($opt->{verbose}) {
+ print "Error parsing log line: $_";
+ }
+ }
}
close($fh);

0 comments on commit 0fb283d

Please sign in to comment.