mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
lsat+loopd: add logger
This commit is contained in:
parent
8cecae501c
commit
31bb18255e
2 changed files with 28 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/lightninglabs/loop"
|
||||
"github.com/lightninglabs/loop/lndclient"
|
||||
"github.com/lightninglabs/loop/loopdb"
|
||||
"github.com/lightninglabs/loop/lsat"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
|
|
@ -19,6 +20,7 @@ func init() {
|
|||
addSubLogger("LOOP", loop.UseLogger)
|
||||
addSubLogger("LNDC", lndclient.UseLogger)
|
||||
addSubLogger("STORE", loopdb.UseLogger)
|
||||
addSubLogger(lsat.Subsystem, lsat.UseLogger)
|
||||
}
|
||||
|
||||
// addSubLogger is a helper method to conveniently create and register the
|
||||
|
|
|
|||
26
lsat/log.go
Normal file
26
lsat/log.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package lsat
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btclog"
|
||||
"github.com/lightningnetwork/lnd/build"
|
||||
)
|
||||
|
||||
// Subsystem defines the sub system name of this package.
|
||||
const Subsystem = "LSAT"
|
||||
|
||||
// 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue