Skip to content

Commit

Permalink
revenue: add logger
Browse files Browse the repository at this point in the history
  • Loading branch information
carlaKC committed Feb 11, 2020
1 parent 5138fa1 commit 7631a74
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/btcsuite/btclog"
"github.com/lightninglabs/terminator/dataset"
"github.com/lightninglabs/terminator/recommend"
"github.com/lightninglabs/terminator/revenue"
"github.com/lightninglabs/terminator/trmrpc"
"github.com/lightningnetwork/lnd/build"
)
Expand All @@ -26,6 +27,7 @@ func init() {
addSubLogger(recommend.Subsystem, recommend.UseLogger)
addSubLogger(dataset.Subsystem, dataset.UseLogger)
addSubLogger(trmrpc.Subsystem, trmrpc.UseLogger)
addSubLogger(revenue.Subsystem, revenue.UseLogger)
}

// UseLogger uses a specified Logger to output package logging info.
Expand Down
26 changes: 26 additions & 0 deletions revenue/log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package revenue

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

// Subsystem defines the logging code for this subsystem.
const Subsystem = "REVN"

// 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() {
UseLogger(build.NewSubLogger(Subsystem, nil))
}

// UseLogger uses a specified Logger to output package logging info.
// This should be used in preference to SetLogWriter if the caller is also
// using btclog.
func UseLogger(logger btclog.Logger) {
log = logger
}

0 comments on commit 7631a74

Please sign in to comment.