MCPcopy
hub / github.com/AdguardTeam/dnsproxy / logWithNonCrit

Function logWithNonCrit

proxy/server.go:224–244  ·  view source on GitHub ↗

logWithNonCrit logs the error on the appropriate level depending on whether err is a critical error or not.

(ctx context.Context, err error, msg string, proto Proto, l *slog.Logger)

Source from the content-addressed store, hash-verified

222// logWithNonCrit logs the error on the appropriate level depending on whether
223// err is a critical error or not.
224func logWithNonCrit(ctx context.Context, err error, msg string, proto Proto, l *slog.Logger) {
225 if errors.Is(err, io.EOF) || errors.Is(err, net.ErrClosed) || isEPIPE(err) {
226 l.DebugContext(
227 ctx,
228 "connection is closed",
229 "proto", proto,
230 "details", msg,
231 slogutil.KeyError, err,
232 )
233 } else if netErr := net.Error(nil); errors.As(err, &netErr) && netErr.Timeout() {
234 l.DebugContext(
235 ctx,
236 "connection timed out",
237 "proto", proto,
238 "details", msg,
239 slogutil.KeyError, err,
240 )
241 } else {
242 l.ErrorContext(ctx, msg, "proto", proto, slogutil.KeyError, err)
243 }
244}

Callers 3

respondMethod · 0.85
handleTCPConnectionMethod · 0.85
readDNSReqMethod · 0.85

Calls 2

isEPIPEFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…