2017-05-01 18:58:08 +02:00
|
|
|
package htlcswitch
|
|
|
|
|
2018-09-20 12:14:50 +02:00
|
|
|
import (
|
2024-10-15 15:16:16 +02:00
|
|
|
"github.com/btcsuite/btclog/v2"
|
2018-09-20 12:14:50 +02:00
|
|
|
"github.com/lightningnetwork/lnd/build"
|
2019-09-05 13:35:39 +02:00
|
|
|
"github.com/lightningnetwork/lnd/htlcswitch/hop"
|
2018-09-20 12:14:50 +02:00
|
|
|
)
|
2017-05-01 18:58:08 +02:00
|
|
|
|
|
|
|
// 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() {
|
2019-09-05 13:35:39 +02:00
|
|
|
logger := build.NewSubLogger("HSWC", nil)
|
|
|
|
|
|
|
|
UseLogger(logger)
|
2017-05-01 18:58:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// DisableLog disables all library log output. Logging output is disabled
|
2017-06-21 17:07:44 +02:00
|
|
|
// by default until UseLogger is called.
|
2017-05-01 18:58:08 +02:00
|
|
|
func DisableLog() {
|
2018-09-20 12:14:50 +02:00
|
|
|
UseLogger(btclog.Disabled)
|
2017-05-01 18:58:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
2019-09-09 13:51:41 +02:00
|
|
|
hop.UseLogger(logger)
|
2017-05-01 18:58:08 +02:00
|
|
|
}
|