diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-12-28 21:18:36 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-12-28 21:18:36 +0000 |
commit | 73ef85bc5db590c22689e11be20737a3dd88168f (patch) | |
tree | fe393a6f0776bca1889b2113ab341a2922e25d10 /vendor/github.com/gorilla/handlers | |
parent | 9e573e571fe878ed32947cae5a6d43cb5d72d3bb (diff) |
Update dependencies
Diffstat (limited to 'vendor/github.com/gorilla/handlers')
-rw-r--r-- | vendor/github.com/gorilla/handlers/recovery.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/vendor/github.com/gorilla/handlers/recovery.go b/vendor/github.com/gorilla/handlers/recovery.go index 65b7de5..b1be9dc 100644 --- a/vendor/github.com/gorilla/handlers/recovery.go +++ b/vendor/github.com/gorilla/handlers/recovery.go @@ -6,9 +6,14 @@ import ( "runtime/debug" ) +// RecoveryHandlerLogger is an interface used by the recovering handler to print logs. +type RecoveryHandlerLogger interface { + Println(...interface{}) +} + type recoveryHandler struct { handler http.Handler - logger *log.Logger + logger RecoveryHandlerLogger printStack bool } @@ -46,7 +51,7 @@ func RecoveryHandler(opts ...RecoveryOption) func(h http.Handler) http.Handler { // RecoveryLogger is a functional option to override // the default logger -func RecoveryLogger(logger *log.Logger) RecoveryOption { +func RecoveryLogger(logger RecoveryHandlerLogger) RecoveryOption { return func(h http.Handler) { r := h.(*recoveryHandler) r.logger = logger @@ -73,11 +78,11 @@ func (h recoveryHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { h.handler.ServeHTTP(w, req) } -func (h recoveryHandler) log(message interface{}) { +func (h recoveryHandler) log(v ...interface{}) { if h.logger != nil { - h.logger.Println(message) + h.logger.Println(v...) } else { - log.Println(message) + log.Println(v...) } if h.printStack { |