summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/server.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-03-30 11:49:53 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-03-30 11:49:53 -0600
commit105acfa08664c97460a6fe3fb49635618be5bcb2 (patch)
tree3c8ea6bc0fa1d335787a5b4852bd03ae50d4ef81 /modules/caddyhttp/server.go
parentdeba26d225c5b321a944439eb6b108117ac3d569 (diff)
Keep type information with placeholders until replacements happen
Diffstat (limited to 'modules/caddyhttp/server.go')
-rw-r--r--modules/caddyhttp/server.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index c7780b0..72a67a7 100644
--- a/modules/caddyhttp/server.go
+++ b/modules/caddyhttp/server.go
@@ -21,7 +21,6 @@ import (
"net"
"net/http"
"net/url"
- "strconv"
"strings"
"time"
@@ -166,9 +165,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer func() {
latency := time.Since(start)
- repl.Set("http.response.status", strconv.Itoa(wrec.Status()))
- repl.Set("http.response.size", strconv.Itoa(wrec.Size()))
- repl.Set("http.response.latency", latency.String())
+ repl.Set("http.response.status", wrec.Status())
+ repl.Set("http.response.size", wrec.Size())
+ repl.Set("http.response.latency", latency)
logger := accLog
if s.Logs != nil && s.Logs.LoggerNames != nil {
@@ -360,9 +359,9 @@ func (*HTTPErrorConfig) WithError(r *http.Request, err error) *http.Request {
// add error values to the replacer
repl := r.Context().Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
- repl.Set("http.error", err.Error())
+ repl.Set("http.error", err)
if handlerErr, ok := err.(HandlerError); ok {
- repl.Set("http.error.status_code", strconv.Itoa(handlerErr.StatusCode))
+ repl.Set("http.error.status_code", handlerErr.StatusCode)
repl.Set("http.error.status_text", http.StatusText(handlerErr.StatusCode))
repl.Set("http.error.trace", handlerErr.Trace)
repl.Set("http.error.id", handlerErr.ID)