Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
rvflash committed Mar 4, 2019
1 parent 3a9309e commit 72fb1fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Binary file modified example/client/client
Binary file not shown.
12 changes: 7 additions & 5 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ func Logger(log *logrus.Logger, fields logrus.Fields) HandlerFunc {
c.Next()
// Logs it.
entry := logrus.NewEntry(log).WithFields(m.fields(c.ResponseWriter, fields))
if e := c.Err(); e == nil {
err := c.Err()
switch {
case err == nil:
entry.Info(m.String())
} else if e.Recovered() {
entry.Errorf("%s %s", m, e)
} else {
entry.Warnf("%s %s", m, e)
case err.Recovered():
entry.Errorf("%s %s", m, err)
default:
entry.Warnf("%s %s", m, err)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ func sleep(_ *tcp.Context) {
}

func stumble(c *tcp.Context) {
c.Error(errors.New("my bad, sorry!"))
c.Error(errors.New("my bad, sorry"))
}
2 changes: 1 addition & 1 deletion response.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (r *responseWriter) incr(n int) {
r.size += n
}

func (r *responseWriter) rebase(w ResponseWriter) {
func (r *responseWriter) rebase(w io.WriteCloser) {
r.ResponseWriter = w
r.size = noWritten
}
Expand Down

0 comments on commit 72fb1fb

Please sign in to comment.