summaryrefslogtreecommitdiff
path: root/source/source.go
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2026-08-20 21:45:20 +0200
committerMel <mel@rnrd.eu>2026-08-20 21:45:20 +0200
commit6a4c0a16118d0b545c3c5f6a08ecad432940c1cf (patch)
tree39da9f54ce2d8a3c2401d4744b2cad6c65565ed1 /source/source.go
parentb52c860a7b1d3f57abc442bb8c1257f228d49536 (diff)
downloadddnnss-6a4c0a16118d0b545c3c5f6a08ecad432940c1cf.tar.zst
ddnnss-6a4c0a16118d0b545c3c5f6a08ecad432940c1cf.zip
Clean logging for modules
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'source/source.go')
-rw-r--r--source/source.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/source.go b/source/source.go
index 6fe139c..ffa380a 100644
--- a/source/source.go
+++ b/source/source.go
@@ -40,7 +40,15 @@ type Source interface {
Lookup(Family) (netip.Addr, error)
}
-func New(log *slog.Logger, cfg Config) (Source, error) {
+func New(log *slog.Logger, name string, cfg Config) (Source, error) {
+ log = log.With(
+ slog.Group(
+ "source",
+ slog.String("name", name),
+ slog.String("kind", string(cfg.Kind)),
+ ),
+ )
+
if cfg.Family != IPv4 && cfg.Family != IPv6 {
return nil, fmt.Errorf("%s source needs family set to ipv4 or ipv6", cfg.Kind)
}