log: add logger for new light client

This commit is contained in:
Olaoluwa Osuntokun 2017-05-18 11:48:10 -07:00
parent b65f92abe2
commit 7283befe2a
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

7
log.go

@ -6,6 +6,7 @@ import (
"github.com/btcsuite/btclog" "github.com/btcsuite/btclog"
"github.com/btcsuite/seelog" "github.com/btcsuite/seelog"
"github.com/lightninglabs/neutrino"
"github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/discovery" "github.com/lightningnetwork/lnd/discovery"
@ -35,6 +36,7 @@ var (
brarLog = btclog.Disabled brarLog = btclog.Disabled
cmgrLog = btclog.Disabled cmgrLog = btclog.Disabled
crtrLog = btclog.Disabled crtrLog = btclog.Disabled
btcnLog = btclog.Disabled
) )
// subsystemLoggers maps each subsystem identifier to its associated logger. // subsystemLoggers maps each subsystem identifier to its associated logger.
@ -53,6 +55,7 @@ var subsystemLoggers = map[string]btclog.Logger{
"BRAR": brarLog, "BRAR": brarLog,
"CMGR": cmgrLog, "CMGR": cmgrLog,
"CRTR": crtrLog, "CRTR": crtrLog,
"BTCN": btcnLog,
} }
// useLogger updates the logger references for subsystemID to logger. Invalid // useLogger updates the logger references for subsystemID to logger. Invalid
@ -112,6 +115,10 @@ func useLogger(subsystemID string, logger btclog.Logger) {
case "CRTR": case "CRTR":
crtrLog = logger crtrLog = logger
routing.UseLogger(crtrLog) routing.UseLogger(crtrLog)
case "BTCN":
btcnLog = logger
neutrino.UseLogger(logger)
} }
} }