From 59b459674dc14558254a6e78795be70a06494510 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Thu, 20 Sep 2018 03:14:50 -0700 Subject: [PATCH] multi: init subsystem loggers via build pkg --- autopilot/log.go | 9 ++++++--- chainntnfs/log.go | 9 ++++++--- channeldb/log.go | 10 ++++++---- contractcourt/log.go | 9 ++++++--- discovery/log.go | 9 ++++++--- htlcswitch/log.go | 9 ++++++--- lnwallet/log.go | 6 ++++-- routing/chainview/log.go | 9 ++++++--- routing/log.go | 5 +++-- signal/log.go | 2 +- 10 files changed, 50 insertions(+), 27 deletions(-) diff --git a/autopilot/log.go b/autopilot/log.go index 70f49947..34e53c84 100644 --- a/autopilot/log.go +++ b/autopilot/log.go @@ -1,6 +1,9 @@ package autopilot -import "github.com/btcsuite/btclog" +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller @@ -9,13 +12,13 @@ var log btclog.Logger // The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("ATPL", nil)) } // DisableLog disables all library log output. Logging output is disabled // by default until UseLogger is called. func DisableLog() { - log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. diff --git a/chainntnfs/log.go b/chainntnfs/log.go index b6a3f148..f2124605 100644 --- a/chainntnfs/log.go +++ b/chainntnfs/log.go @@ -1,6 +1,9 @@ package chainntnfs -import "github.com/btcsuite/btclog" +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) // Log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller @@ -9,13 +12,13 @@ var Log btclog.Logger // The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("NTFN", nil)) } // DisableLog disables all library log output. Logging output is disabled // by default until UseLogger is called. func DisableLog() { - Log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. diff --git a/channeldb/log.go b/channeldb/log.go index d44192e7..e0158d45 100644 --- a/channeldb/log.go +++ b/channeldb/log.go @@ -1,21 +1,23 @@ package channeldb -import "github.com/btcsuite/btclog" +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller // requests it. var log btclog.Logger -// The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("CHDB", nil)) } // DisableLog disables all library log output. Logging output is disabled // by default until UseLogger is called. func DisableLog() { - log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. diff --git a/contractcourt/log.go b/contractcourt/log.go index 0168177c..e8b70719 100644 --- a/contractcourt/log.go +++ b/contractcourt/log.go @@ -1,6 +1,9 @@ package contractcourt -import "github.com/btcsuite/btclog" +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller @@ -9,13 +12,13 @@ var log btclog.Logger // The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("CNCT", nil)) } // DisableLog disables all library log output. Logging output is disabled // by default until UseLogger is called. func DisableLog() { - log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. diff --git a/discovery/log.go b/discovery/log.go index 7d38664c..bd2004d3 100644 --- a/discovery/log.go +++ b/discovery/log.go @@ -1,6 +1,9 @@ package discovery -import "github.com/btcsuite/btclog" +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller @@ -9,13 +12,13 @@ var log btclog.Logger // The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("DISC", nil)) } // DisableLog disables all library log output. Logging output is disabled // by default until UseLogger is called. func DisableLog() { - log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. diff --git a/htlcswitch/log.go b/htlcswitch/log.go index bd4593a3..63fe63a1 100644 --- a/htlcswitch/log.go +++ b/htlcswitch/log.go @@ -1,6 +1,9 @@ package htlcswitch -import "github.com/btcsuite/btclog" +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller @@ -9,13 +12,13 @@ var log btclog.Logger // The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("HSWC", nil)) } // DisableLog disables all library log output. Logging output is disabled // by default until UseLogger is called. func DisableLog() { - log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. diff --git a/lnwallet/log.go b/lnwallet/log.go index f36aa99f..97f1c21f 100644 --- a/lnwallet/log.go +++ b/lnwallet/log.go @@ -5,6 +5,8 @@ import ( "github.com/btcsuite/btcwallet/chain" btcwallet "github.com/btcsuite/btcwallet/wallet" "github.com/btcsuite/btcwallet/wtxmgr" + + "github.com/lightningnetwork/lnd/build" ) // walletLog is a logger that is initialized with no output filters. This @@ -14,13 +16,13 @@ var walletLog btclog.Logger // The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("LNWL", nil)) } // DisableLog disables all library log output. Logging output is disabled // by default until UseLogger is called. func DisableLog() { - walletLog = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. diff --git a/routing/chainview/log.go b/routing/chainview/log.go index cb3b59a2..b411819d 100644 --- a/routing/chainview/log.go +++ b/routing/chainview/log.go @@ -1,6 +1,9 @@ package chainview -import "github.com/btcsuite/btclog" +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller @@ -9,13 +12,13 @@ var log btclog.Logger // The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("CRTR", nil)) } // DisableLog disables all library log output. Logging output is disabled // by default until either UseLogger or SetLogWriter are called. func DisableLog() { - log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. diff --git a/routing/log.go b/routing/log.go index b990aa74..ce550812 100644 --- a/routing/log.go +++ b/routing/log.go @@ -2,6 +2,7 @@ package routing import ( "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/routing/chainview" ) @@ -12,13 +13,13 @@ var log btclog.Logger // The default amount of logging is none. func init() { - DisableLog() + UseLogger(build.NewSubLogger("CRTR", nil)) } // DisableLog disables all library log output. Logging output is disabled by // by default until UseLogger is called. func DisableLog() { - log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info. This diff --git a/signal/log.go b/signal/log.go index e7034321..6bde284b 100644 --- a/signal/log.go +++ b/signal/log.go @@ -15,7 +15,7 @@ func init() { // DisableLog disables all library log output. Logging output is disabled // by default until UseLogger is called. func DisableLog() { - log = btclog.Disabled + UseLogger(btclog.Disabled) } // UseLogger uses a specified Logger to output package logging info.