Skip to content

Commit 9118202

Browse files
committed
supplycommit: add logging support
1 parent 8e552a1 commit 9118202

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

log.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/lightninglabs/taproot-assets/tapgarden"
1515
"github.com/lightninglabs/taproot-assets/tapsend"
1616
"github.com/lightninglabs/taproot-assets/universe"
17+
"github.com/lightninglabs/taproot-assets/universe/supplycommit"
1718
"github.com/lightningnetwork/lnd/build"
1819
"github.com/lightningnetwork/lnd/signal"
1920
)
@@ -109,6 +110,10 @@ func SetupLoggers(root *build.SubLoggerManager,
109110
AddSubLogger(root, address.Subsystem, interceptor, address.UseLogger)
110111
AddSubLogger(root, tapsend.Subsystem, interceptor, tapsend.UseLogger)
111112
AddSubLogger(root, universe.Subsystem, interceptor, universe.UseLogger)
113+
AddSubLogger(
114+
root, supplycommit.Subsystem, interceptor,
115+
supplycommit.UseLogger,
116+
)
112117
AddSubLogger(
113118
root, commitment.Subsystem, interceptor, commitment.UseLogger,
114119
)

universe/supplycommit/log.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package supplycommit
2+
3+
import (
4+
"github.com/btcsuite/btclog/v2"
5+
)
6+
7+
// Subsystem defines the logging code for this subsystem.
8+
const Subsystem = "SUCO"
9+
10+
// log is a logger that is initialized with no output filters. This
11+
// means the package will not perform any logging by default until the caller
12+
// requests it.
13+
var log = btclog.Disabled
14+
15+
// DisableLog disables all library log output. Logging output is disabled
16+
// by default until UseLogger is called.
17+
func DisableLog() {
18+
UseLogger(btclog.Disabled)
19+
}
20+
21+
// UseLogger uses a specified Logger to output package logging info.
22+
// This should be used in preference to SetLogWriter if the caller is also
23+
// using btclog.
24+
func UseLogger(logger btclog.Logger) {
25+
log = logger
26+
}

0 commit comments

Comments
 (0)