Skip to content

Commit 6a1b082

Browse files
committed
config: register subserver loggers before validation
Ensure that all of Lit's subserver loggers have been registered _before_ the config is validated. This will allow users to use the `--lnd.debuglevel` flag to set Lit specific subserever logger levels.
1 parent 1250ece commit 6a1b082

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

config.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,19 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) {
329329
os.Exit(0)
330330
}
331331

332+
// Before we validate the config, we first hook up our own loggers.
333+
// This must be done before the config is validated if LND is running
334+
// in integrated mode so that the log levels for various non-LND related
335+
// subsystems can be set via the `lnd.debuglevel` flag.
336+
SetupLoggers(preCfg.Lnd.LogWriter, interceptor)
337+
332338
// Load the main configuration file and parse any command line options.
333339
// This function will also set up logging properly.
334340
cfg, err := loadConfigFile(preCfg, interceptor)
335341
if err != nil {
336342
return nil, err
337343
}
338344

339-
// With the validated config obtained, we now know that the root logging
340-
// system of lnd is initialized and we can hook up our own loggers now.
341-
SetupLoggers(cfg.Lnd.LogWriter, interceptor)
342-
343345
// Translate the more user friendly string modes into the more developer
344346
// friendly internal bool variables now.
345347
cfg.lndRemote = cfg.LndMode == ModeRemote

0 commit comments

Comments
 (0)