diff options
author | Kévin Dunglas <[email protected]> | 2024-09-13 19:16:37 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-13 11:16:37 -0600 |
commit | f4bf4e0097853438eb69c573bbaa0581e9b9c02d (patch) | |
tree | 2c01222faa34d3c95072094a2f80c41b1563c19e /modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go | |
parent | 21f9c20a04ec5c2ac430daa8e4ba8fbdef67f773 (diff) | |
download | caddy-f4bf4e0097853438eb69c573bbaa0581e9b9c02d.tar.gz caddy-f4bf4e0097853438eb69c573bbaa0581e9b9c02d.zip |
perf: use zap's Check() to prevent useless allocs (#6560)
* perf: use zap's Check() to prevent useless allocs
* fix
* fix
* fix
* fix
* restore previous replacer behavior
* fix linter
Diffstat (limited to 'modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go')
-rw-r--r-- | modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go index 31febdd4e..3985465ba 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go @@ -148,10 +148,13 @@ func (t Transport) RoundTrip(r *http.Request) (*http.Response, error) { zap.Object("request", loggableReq), zap.Object("env", loggableEnv), ) - logger.Debug("roundtrip", - zap.String("dial", address), - zap.Object("env", loggableEnv), - zap.Object("request", loggableReq)) + if c := t.logger.Check(zapcore.DebugLevel, "roundtrip"); c != nil { + c.Write( + zap.String("dial", address), + zap.Object("env", loggableEnv), + zap.Object("request", loggableReq), + ) + } // connect to the backend dialer := net.Dialer{Timeout: time.Duration(t.DialTimeout)} |