|
|
|
|
@ -185,9 +185,9 @@ type ReturnHandler interface { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type HandlerOptions struct { |
|
|
|
|
Quiet200s bool // if set, do not log successfully handled HTTP requests
|
|
|
|
|
Logf logger.Logf |
|
|
|
|
Now func() time.Time // if nil, defaults to time.Now
|
|
|
|
|
QuietLoggingIfSuccessful bool // if set, do not log successfully handled HTTP requests (200 and 304 status codes)
|
|
|
|
|
Logf logger.Logf |
|
|
|
|
Now func() time.Time // if nil, defaults to time.Now
|
|
|
|
|
|
|
|
|
|
// If non-nil, StatusCodeCounters maintains counters
|
|
|
|
|
// of status codes for handled responses.
|
|
|
|
|
@ -317,7 +317,7 @@ func (h retHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if msg.Code != 200 || !h.opts.Quiet200s { |
|
|
|
|
if !h.opts.QuietLoggingIfSuccessful || (msg.Code != http.StatusOK && msg.Code != http.StatusNotModified) { |
|
|
|
|
h.opts.Logf("%s", msg) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|