mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-02 01:33:11 +08:00
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
This commit is contained in:
@ -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)}
|
||||
|
Reference in New Issue
Block a user