Skip to content

Commit

Permalink
Merge pull request lightninglabs#560 from ziggie1984/bugfix-nil-pointer
Browse files Browse the repository at this point in the history
loopd: nil-pointer bug when showing subsystems
  • Loading branch information
hieblmi authored Nov 18, 2024
2 parents 40328fe + 5db270d commit 7f13441
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 0 additions & 2 deletions loopd/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
const Subsystem = "LOOPD"

var (
logWriter *build.RotatingLogWriter
log btclog.Logger
interceptor signal.Interceptor
)
Expand All @@ -30,7 +29,6 @@ var (
func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) {
genLogger := genSubLogger(root, intercept)

logWriter = root
log = build.NewSubLogger(Subsystem, genLogger)
interceptor = intercept

Expand Down
15 changes: 8 additions & 7 deletions loopd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,6 @@ func Run(rpcCfg RPCConfig) error {
os.Exit(0)
}

// Special show command to list supported subsystems and exit.
if config.DebugLevel == "show" {
fmt.Printf("Supported subsystems: %v\n",
logWriter.SupportedSubsystems())
os.Exit(0)
}

// Validate our config before we proceed.
if err := Validate(&config); err != nil {
return err
Expand All @@ -205,6 +198,14 @@ func Run(rpcCfg RPCConfig) error {
logWriter := build.NewRotatingLogWriter()
SetupLoggers(logWriter, shutdownInterceptor)

// Special show command to list supported subsystems and exit.
if config.DebugLevel == "show" {
fmt.Printf("Supported subsystems: %v\n",
logWriter.SupportedSubsystems())

os.Exit(0)
}

err = logWriter.InitLogRotator(
filepath.Join(config.LogDir, defaultLogFilename),
config.MaxLogFileSize, config.MaxLogFiles,
Expand Down

0 comments on commit 7f13441

Please sign in to comment.