Skip to content

Commit 31bb182

Browse files
committed
lsat+loopd: add logger
1 parent 8cecae5 commit 31bb182

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

cmd/loopd/log.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/lightninglabs/loop"
66
"github.com/lightninglabs/loop/lndclient"
77
"github.com/lightninglabs/loop/loopdb"
8+
"github.com/lightninglabs/loop/lsat"
89
"github.com/lightningnetwork/lnd/build"
910
)
1011

@@ -19,6 +20,7 @@ func init() {
1920
addSubLogger("LOOP", loop.UseLogger)
2021
addSubLogger("LNDC", lndclient.UseLogger)
2122
addSubLogger("STORE", loopdb.UseLogger)
23+
addSubLogger(lsat.Subsystem, lsat.UseLogger)
2224
}
2325

2426
// addSubLogger is a helper method to conveniently create and register the

lsat/log.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package lsat
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 = "LSAT"
10+
11+
// log is a logger that is initialized with no output filters. This
12+
// means the package will not perform any logging by default until the caller
13+
// requests it.
14+
var log btclog.Logger
15+
16+
// The default amount of logging is none.
17+
func init() {
18+
UseLogger(build.NewSubLogger(Subsystem, nil))
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)