Skip to content

Commit 7262c2f

Browse files
committed
log: static address loop-in logging
1 parent 9ef2c6f commit 7262c2f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

staticaddr/log.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/btcsuite/btclog"
55
"github.com/lightninglabs/loop/staticaddr/address"
66
"github.com/lightninglabs/loop/staticaddr/deposit"
7+
"github.com/lightninglabs/loop/staticaddr/loopin"
78
"github.com/lightninglabs/loop/staticaddr/withdraw"
89
"github.com/lightningnetwork/lnd/build"
910
)
@@ -27,4 +28,5 @@ func UseLogger(logger btclog.Logger) {
2728
address.UseLogger(log)
2829
deposit.UseLogger(log)
2930
withdraw.UseLogger(log)
31+
loopin.UseLogger(log)
3032
}

staticaddr/loopin/log.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package loopin
2+
3+
import (
4+
"github.com/btcsuite/btclog"
5+
"github.com/lightningnetwork/lnd/build"
6+
)
7+
8+
// Subsystem defines the sub system name of this package.
9+
const Subsystem = "SADDR"
10+
11+
// log is a logger that is initialized with no output filters. This means the
12+
// package will not perform any logging by default until the caller requests it.
13+
var log btclog.Logger
14+
15+
// The default amount of logging is none.
16+
func init() {
17+
UseLogger(build.NewSubLogger(Subsystem, nil))
18+
}
19+
20+
// UseLogger uses a specified Logger to output package logging info. This should
21+
// be used in preference to SetLogWriter if the caller is also using btclog.
22+
func UseLogger(logger btclog.Logger) {
23+
log = logger
24+
}

0 commit comments

Comments
 (0)