loop/sweepbatcher/log.go

32 lines
829 B
Go
Raw Permalink Normal View History

2023-08-23 17:44:01 +03:00
package sweepbatcher
import (
"fmt"
"github.com/btcsuite/btclog"
"github.com/lightningnetwork/lnd/build"
)
// 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("SWEEP", nil))
}
2024-05-28 22:35:08 -03:00
// batchPrefixLogger returns a logger that prefixes all log messages with
// the ID.
2023-08-23 17:44:01 +03:00
func batchPrefixLogger(batchID string) btclog.Logger {
return build.NewPrefixLog(fmt.Sprintf("[Batch %s]", batchID), log)
}
// 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
}