Debian Codegraph @

cmd/atomdns/internal/dnsctx/log.go

raw
1 package dnsctx
2
3 import (
4 "context"
5 "log/slog"
6 )
7
8 // Id returns a slog.Attr that either is empty or contains the request id as added by the id handler.
9 func Id(ctx context.Context) slog.Attr {
10 id := slog.Attr{}
11 if x := String(ctx, "id/id"); x != "" {
12 id = slog.Group("id", slog.String("id", x))
13 }
14 return id
15 }