Skip to content

Commit

Permalink
only print stack for FATAL and ERROR
Browse files Browse the repository at this point in the history
  • Loading branch information
fffw committed Aug 16, 2016
1 parent c76b05e commit ea6360c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/github.com/getlantern/golog/golog.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,17 @@ func (l *logger) print(out io.Writer, skipFrames int, severity string, arg inter
buf.WriteString(" ")
buf.WriteString(linePrefix)
if arg != nil {
err, isError := arg.(errors.Error)
if !isError {
fmt.Fprintf(buf, "%v", arg)
if err, isError := arg.(errors.Error); isError && err != nil {
buf.WriteString(err.Error())
printContext(buf, arg)
buf.WriteByte('\n')
if severity == "FATAL" || severity == "ERROR" {
err.PrintStack(buf)
}
} else {
buf.WriteString(err.Error())
fmt.Fprintf(buf, "%v", arg)
printContext(buf, arg)
buf.WriteByte('\n')
err.PrintStack(buf)
}
}
b := []byte(hidden.Clean(buf.String()))
Expand Down

0 comments on commit ea6360c

Please sign in to comment.