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/caddytls/certmanagers.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/caddytls/certmanagers.go')
-rw-r--r-- | modules/caddytls/certmanagers.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/caddytls/certmanagers.go b/modules/caddytls/certmanagers.go index f65a78b09..56950bc84 100644 --- a/modules/caddytls/certmanagers.go +++ b/modules/caddytls/certmanagers.go @@ -12,6 +12,7 @@ import ( "github.com/caddyserver/certmagic" "github.com/tailscale/tscert" "go.uber.org/zap" + "go.uber.org/zap/zapcore" "github.com/caddyserver/caddy/v2" "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" @@ -46,7 +47,9 @@ func (ts Tailscale) GetCertificate(ctx context.Context, hello *tls.ClientHelloIn return nil, nil // pass-thru: Tailscale can't offer a cert for this name } if err != nil { - ts.logger.Warn("could not get status; will try to get certificate anyway", zap.Error(err)) + if c := ts.logger.Check(zapcore.WarnLevel, "could not get status; will try to get certificate anyway"); c != nil { + c.Write(zap.Error(err)) + } } return tscert.GetCertificateWithContext(ctx, hello) } |