Skip to content

Commit

Permalink
multi: init subsystem loggers via build pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
cfromknecht committed Oct 5, 2018
1 parent 9654a1c commit 59b4596
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 27 deletions.
9 changes: 6 additions & 3 deletions autopilot/log.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions chainntnfs/log.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
10 changes: 6 additions & 4 deletions channeldb/log.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
9 changes: 6 additions & 3 deletions contractcourt/log.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions discovery/log.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions htlcswitch/log.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions lnwallet/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions routing/chainview/log.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions routing/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package routing

import (
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/routing/chainview"
)

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion signal/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 59b4596

Please sign in to comment.