Skip to content

Commit 82f2b9f

Browse files
committed
staticaddr: deposit logger
1 parent e3bec2a commit 82f2b9f

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

loopd/log.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import (
1010
"github.com/lightninglabs/loop/instantout/reservation"
1111
"github.com/lightninglabs/loop/liquidity"
1212
"github.com/lightninglabs/loop/loopdb"
13-
"github.com/lightninglabs/loop/staticaddr"
13+
"github.com/lightninglabs/loop/staticaddr/address"
14+
"github.com/lightninglabs/loop/staticaddr/deposit"
1415
"github.com/lightninglabs/loop/sweepbatcher"
1516
"github.com/lightningnetwork/lnd"
1617
"github.com/lightningnetwork/lnd/build"
@@ -38,7 +39,8 @@ func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) {
3839
lnd.AddSubLogger(root, "SWEEP", intercept, sweepbatcher.UseLogger)
3940
lnd.AddSubLogger(root, "LNDC", intercept, lndclient.UseLogger)
4041
lnd.AddSubLogger(root, "STORE", intercept, loopdb.UseLogger)
41-
lnd.AddSubLogger(root, "SADDR", intercept, staticaddr.UseLogger)
42+
lnd.AddSubLogger(root, "SADDR", intercept, address.UseLogger)
43+
lnd.AddSubLogger(root, "DEPO", intercept, deposit.UseLogger)
4244
lnd.AddSubLogger(root, lsat.Subsystem, intercept, lsat.UseLogger)
4345
lnd.AddSubLogger(
4446
root, liquidity.Subsystem, intercept, liquidity.UseLogger,

staticaddr/address/log.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package address
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+
}
25+
26+
// GetLogger returns the logger for this package.
27+
func GetLogger() btclog.Logger {
28+
return log
29+
}

staticaddr/log.go renamed to staticaddr/deposit/log.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package staticaddr
1+
package deposit
22

33
import (
44
"github.com/btcsuite/btclog"
55
"github.com/lightningnetwork/lnd/build"
66
)
77

88
// Subsystem defines the sub system name of this package.
9-
const Subsystem = "SADDR"
9+
const Subsystem = "DEPO"
1010

1111
// log is a logger that is initialized with no output filters. This means the
1212
// package will not perform any logging by default until the caller requests it.

0 commit comments

Comments
 (0)