1 // Copyright (c) 2014-2017 The btcsuite developers
2 // Use of this source code is governed by an ISC
3 // license that can be found in the LICENSE file.
8 "github.com/btcsuite/btclog"
11 // log is a logger that is initialized with no output filters. This
12 // means the package will not perform any logging by default until the caller
16 // The default amount of logging is none.
21 // DisableLog disables all library log output. Logging output is disabled
22 // by default until UseLogger is called.
27 // UseLogger uses a specified Logger to output package logging info.
28 func UseLogger(logger btclog.Logger) {
32 // LogClosure is a closure that can be printed with %v to be used to
33 // generate expensive-to-create data for a detailed log level and avoid doing
34 // the work if the data isn't printed.
35 type logClosure func() string
37 // String invokes the log closure and returns the results string.
38 func (c logClosure) String() string {
42 // newLogClosure returns a new closure over the passed function which allows
43 // it to be used as a parameter in a logging function that is only invoked when
44 // the logging level is such that the message will actually be logged.
45 func newLogClosure(c func() string) logClosure {