Browse Source

lsat+loopd: add logger

pull/101/head
Oliver Gugger 1 year ago
parent
commit
31bb18255e
No known key found for this signature in database GPG Key ID: 8E4256593F177720
2 changed files with 28 additions and 0 deletions
  1. +2
    -0
      cmd/loopd/log.go
  2. +26
    -0
      lsat/log.go

+ 2
- 0
cmd/loopd/log.go View File

@ -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
- 0
lsat/log.go View 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…
Cancel
Save