all: eliminate usage of global ProxyLogger

So setting up logging for ctrld binary and ctrld packages could be done
more easily, decouple the required setup for interactive vs daemon
running.

This is the first step toward replacing rs/zerolog libary with a
different logging library.
This commit is contained in:
Cuong Manh Le
2025-04-03 21:17:02 +07:00
committed by Cuong Manh Le
parent 5641aab5bd
commit fc527dbdfb
39 changed files with 425 additions and 420 deletions
+2 -1
View File
@@ -102,6 +102,7 @@ func (p *prog) checkDnsLoop() {
}
p.loopMu.Unlock()
loggerCtx := ctrld.LoggerCtx(context.Background(), mainLog.Load())
for uid := range p.loop {
msg := loopTestMsg(uid)
uc := upstream[uid]
@@ -109,7 +110,7 @@ func (p *prog) checkDnsLoop() {
if uc == nil {
continue
}
resolver, err := ctrld.NewResolver(uc)
resolver, err := ctrld.NewResolver(loggerCtx, uc)
if err != nil {
mainLog.Load().Warn().Err(err).Msgf("could not perform loop check for upstream: %q, endpoint: %q", uc.Name, uc.Endpoint)
continue