2015-12-26 21:35:15 +03:00
|
|
|
package channeldb
|
2016-03-23 04:43:10 +03:00
|
|
|
|
2018-09-20 13:14:50 +03:00
|
|
|
import (
|
|
|
|
"github.com/btcsuite/btclog"
|
|
|
|
"github.com/lightningnetwork/lnd/build"
|
2020-11-09 12:21:28 +03:00
|
|
|
"github.com/lightningnetwork/lnd/channeldb/kvdb"
|
2020-05-22 01:36:26 +03:00
|
|
|
mig "github.com/lightningnetwork/lnd/channeldb/migration"
|
2019-11-22 13:24:28 +03:00
|
|
|
"github.com/lightningnetwork/lnd/channeldb/migration12"
|
2020-02-20 20:08:01 +03:00
|
|
|
"github.com/lightningnetwork/lnd/channeldb/migration13"
|
2020-06-10 13:34:27 +03:00
|
|
|
"github.com/lightningnetwork/lnd/channeldb/migration16"
|
2019-10-29 14:07:59 +03:00
|
|
|
"github.com/lightningnetwork/lnd/channeldb/migration_01_to_11"
|
2018-09-20 13:14:50 +03:00
|
|
|
)
|
2016-03-23 04:43:10 +03: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
|
|
|
|
|
|
|
|
func init() {
|
2018-09-20 13:14:50 +03:00
|
|
|
UseLogger(build.NewSubLogger("CHDB", nil))
|
2016-03-23 04:43:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// DisableLog disables all library log output. Logging output is disabled
|
2017-06-21 18:07:44 +03:00
|
|
|
// by default until UseLogger is called.
|
2016-03-23 04:43:10 +03:00
|
|
|
func DisableLog() {
|
2018-09-20 13:14:50 +03:00
|
|
|
UseLogger(btclog.Disabled)
|
2016-03-23 04:43:10 +03: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
|
2020-05-22 01:36:26 +03:00
|
|
|
mig.UseLogger(logger)
|
2019-10-29 14:07:59 +03:00
|
|
|
migration_01_to_11.UseLogger(logger)
|
2019-11-22 13:24:28 +03:00
|
|
|
migration12.UseLogger(logger)
|
2020-02-20 20:08:01 +03:00
|
|
|
migration13.UseLogger(logger)
|
2020-06-10 13:34:27 +03:00
|
|
|
migration16.UseLogger(logger)
|
2020-11-09 12:21:28 +03:00
|
|
|
kvdb.UseLogger(logger)
|
2016-03-23 04:43:10 +03:00
|
|
|
}
|