all: partial revert slog logger usage

This commit is contained in:
Dimitry Kolyshev 2024-07-05 16:19:27 +03:00
parent f16cddbb8c
commit cdf9ccd371
6 changed files with 33 additions and 84 deletions
internal/home

View file

@ -39,7 +39,6 @@ import (
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/hostsfile"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/logutil/slogutil"
"github.com/AdguardTeam/golibs/netutil"
"github.com/AdguardTeam/golibs/osutil"
)
@ -559,15 +558,14 @@ func run(opts options, clientBuildFS fs.FS, done chan struct{}) {
err = configureLogger(ls)
fatalOnError(err)
// Configure slog logger.
l, err := initLogger(ls)
fatalOnError(err)
// TODO(a.garipov): Use slog everywhere.
l := initLogger(ls)
// Print the first message after logger is configured.
l.Info(version.Full())
l.Debug("current working directory is set", "work_dir", Context.workDir)
log.Info(version.Full())
log.Debug("current working directory is %s", Context.workDir)
if opts.runningAsService {
l.Info("AdGuard Home is running as a service")
log.Info("AdGuard Home is running as a service")
}
err = setupContext(opts, l)
@ -598,7 +596,7 @@ func run(opts options, clientBuildFS fs.FS, done chan struct{}) {
}
confPath := configFilePath()
l.Debug("using config path for updater", "path", confPath)
log.Debug("using config path %q for updater", confPath)
upd := updater.NewUpdater(&updater.Config{
Client: config.Filtering.HTTPClient,
@ -640,7 +638,7 @@ func run(opts options, clientBuildFS fs.FS, done chan struct{}) {
Context.tls, err = newTLSManager(config.TLS, config.DNS.ServePlainDNS)
if err != nil {
l.Error("initializing tls", slogutil.KeyError, err)
log.Error("initializing tls: %s", err)
onConfigModified()
}
@ -664,7 +662,7 @@ func run(opts options, clientBuildFS fs.FS, done chan struct{}) {
if Context.dhcpServer != nil {
err = Context.dhcpServer.Start()
if err != nil {
l.Error("starting dhcp server", slogutil.KeyError, err)
log.Error("starting dhcp server: %s", err)
}
}
}