Merge pull request #4754 from carlaKC/chainreg-uselogger

chainreg: register logger
This commit is contained in:
Olaoluwa Osuntokun 2020-11-09 11:48:51 -08:00 committed by GitHub
commit 339a9d3915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

@ -5,12 +5,15 @@ import (
"github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/build"
) )
// Subsystem defines the logging code for this subsystem.
const Subsystem = "CHRE"
// log is a logger that is initialized with the btclog.Disabled logger. // log is a logger that is initialized with the btclog.Disabled logger.
var log btclog.Logger var log btclog.Logger
// The default amount of logging is none. // The default amount of logging is none.
func init() { func init() {
UseLogger(build.NewSubLogger("CHRE", nil)) UseLogger(build.NewSubLogger(Subsystem, nil))
} }
// DisableLog disables all logging output. // DisableLog disables all logging output.

2
log.go

@ -10,6 +10,7 @@ import (
"github.com/lightningnetwork/lnd/autopilot" "github.com/lightningnetwork/lnd/autopilot"
"github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/chainreg"
"github.com/lightningnetwork/lnd/chanbackup" "github.com/lightningnetwork/lnd/chanbackup"
"github.com/lightningnetwork/lnd/chanfitness" "github.com/lightningnetwork/lnd/chanfitness"
"github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/channeldb"
@ -131,6 +132,7 @@ func SetupLoggers(root *build.RotatingLogWriter) {
AddSubLogger(root, chanfitness.Subsystem, chanfitness.UseLogger) AddSubLogger(root, chanfitness.Subsystem, chanfitness.UseLogger)
AddSubLogger(root, verrpc.Subsystem, verrpc.UseLogger) AddSubLogger(root, verrpc.Subsystem, verrpc.UseLogger)
AddSubLogger(root, healthcheck.Subsystem, healthcheck.UseLogger) AddSubLogger(root, healthcheck.Subsystem, healthcheck.UseLogger)
AddSubLogger(root, chainreg.Subsystem, chainreg.UseLogger)
} }
// AddSubLogger is a helper method to conveniently create and register the // AddSubLogger is a helper method to conveniently create and register the