Skip to content

Commit

Permalink
Merge pull request #114 from gocardless/lawrence-remove-the-other-pla…
Browse files Browse the repository at this point in the history
…ce-we-log-access-tokens

Remove another place we log access tokens
  • Loading branch information
lawrencejones authored Aug 13, 2020
2 parents a0c286b + 8ec4060 commit f9f12db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/server/api/middleware/error_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import (
func NewErrorHandler(logger log.Logger) chain.TerminatingMiddleware {
return func(next chain.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
err := next(w, r)
if err != nil {
logger.With("http_request", r).Error(err.Error())
}
next(w, r)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/server/api/middleware/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func NewRequestLogger(logger log.Logger) chain.Middleware {
duration.Seconds(),
)

if err != nil {
scopedLogger = scopedLogger.With("error", err.Error())
}

scopedLogger.
With("status", recorder.Code).
With("duration", duration.Seconds()).
Expand Down

0 comments on commit f9f12db

Please sign in to comment.