multi: init subsystem loggers via build pkg

This commit is contained in:
Conner Fromknecht 2018-09-20 03:14:50 -07:00
parent 9654a1c619
commit 59b459674d
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
10 changed files with 50 additions and 27 deletions

@ -1,6 +1,9 @@
package autopilot 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 // 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 // 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. // The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("ATPL", nil))
} }
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.

@ -1,6 +1,9 @@
package chainntnfs 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 // 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 // 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. // The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("NTFN", nil))
} }
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
Log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.

@ -1,21 +1,23 @@
package channeldb 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 // 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 // means the package will not perform any logging by default until the caller
// requests it. // requests it.
var log btclog.Logger var log btclog.Logger
// The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("CHDB", nil))
} }
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.

@ -1,6 +1,9 @@
package contractcourt 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 // 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 // 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. // The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("CNCT", nil))
} }
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.

@ -1,6 +1,9 @@
package discovery 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 // 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 // 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. // The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("DISC", nil))
} }
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.

@ -1,6 +1,9 @@
package htlcswitch 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 // 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 // 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. // The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("HSWC", nil))
} }
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.

@ -5,6 +5,8 @@ import (
"github.com/btcsuite/btcwallet/chain" "github.com/btcsuite/btcwallet/chain"
btcwallet "github.com/btcsuite/btcwallet/wallet" btcwallet "github.com/btcsuite/btcwallet/wallet"
"github.com/btcsuite/btcwallet/wtxmgr" "github.com/btcsuite/btcwallet/wtxmgr"
"github.com/lightningnetwork/lnd/build"
) )
// walletLog is a logger that is initialized with no output filters. This // 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. // The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("LNWL", nil))
} }
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
walletLog = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.

@ -1,6 +1,9 @@
package chainview 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 // 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 // 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. // The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("CRTR", nil))
} }
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until either UseLogger or SetLogWriter are called. // by default until either UseLogger or SetLogWriter are called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.

@ -2,6 +2,7 @@ package routing
import ( import (
"github.com/btcsuite/btclog" "github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/routing/chainview" "github.com/lightningnetwork/lnd/routing/chainview"
) )
@ -12,13 +13,13 @@ var log btclog.Logger
// The default amount of logging is none. // The default amount of logging is none.
func init() { func init() {
DisableLog() UseLogger(build.NewSubLogger("CRTR", nil))
} }
// DisableLog disables all library log output. Logging output is disabled by // DisableLog disables all library log output. Logging output is disabled by
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. This // UseLogger uses a specified Logger to output package logging info. This

@ -15,7 +15,7 @@ func init() {
// DisableLog disables all library log output. Logging output is disabled // DisableLog disables all library log output. Logging output is disabled
// by default until UseLogger is called. // by default until UseLogger is called.
func DisableLog() { func DisableLog() {
log = btclog.Disabled UseLogger(btclog.Disabled)
} }
// UseLogger uses a specified Logger to output package logging info. // UseLogger uses a specified Logger to output package logging info.