2017-03-19 19:40:25 +01:00
|
|
|
package discovery
|
|
|
|
|
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"
|
|
|
|
)
|
2017-03-19 19:40:25 +01: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() {
|
2018-09-20 12:14:50 +02:00
|
|
|
UseLogger(build.NewSubLogger("DISC", nil))
|
2017-03-19 19:40:25 +01: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-03-19 19:40:25 +01:00
|
|
|
func DisableLog() {
|
2018-09-20 12:14:50 +02:00
|
|
|
UseLogger(btclog.Disabled)
|
2017-03-19 19:40:25 +01: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
|
|
|
|
}
|