Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
cmd/log-parser: Improve errors
Browse files Browse the repository at this point in the history
Enhance some of the errors that are returned to make locating the issue
in the log file easier.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
  • Loading branch information
jodh-intel committed Jul 4, 2018
1 parent 92e76c4 commit 960604e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/log-parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ func createLogEntry(filename string, line uint64, pairs kvPairs) (LogEntry, erro
}

if line == 0 {
return LogEntry{}, fmt.Errorf("need line number")
return LogEntry{}, fmt.Errorf("need line number for file %v", filename)
}

if pairs == nil || len(pairs) == 0 {
return LogEntry{}, fmt.Errorf("need key/value pairs")
return LogEntry{}, fmt.Errorf("need key/value pairs for line %v:%d", filename, line)
}

l := LogEntry{}
Expand All @@ -290,7 +290,7 @@ func createLogEntry(filename string, line uint64, pairs kvPairs) (LogEntry, erro
return LogEntry{}, err
}

logger.Warnf("failed to unpack agent log entry: %v", l)
logger.Warnf("failed to unpack agent log entry %v: %v", l, err)
} else {
// the agent log entry totally replaces the proxy log entry
// that encapsulated it.
Expand Down

0 comments on commit 960604e

Please sign in to comment.