Skip to content

Commit daab70c

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 06bb73f commit daab70c

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
@@ -328,17 +328,19 @@ func loadAndValidateConfig(interceptor signal.Interceptor) (*Config, error) {
328328
os.Exit(0)
329329
}
330330

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

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

0 commit comments

Comments
 (0)