build: separate sublogger and rotator pipe management

These are two separate concerns. So this commit splits them up and just
passes a LogWriter from the one to the other. This will become cleaner
in an upcoming commit where the Rotator will implement io.Writer and
there will no longer be a need for LogWriter.
This commit is contained in:
Elle Mouton
2024-09-10 18:21:35 +02:00
parent ec5b39c120
commit 387a1a8831
6 changed files with 169 additions and 107 deletions

2
lnd.go
View File

@@ -149,7 +149,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
defer func() {
ltndLog.Info("Shutdown complete\n")
err := cfg.LogWriter.Close()
err := cfg.LogRotator.Close()
if err != nil {
ltndLog.Errorf("Could not close log rotator: %v", err)
}