/ msgmux / log.go
log.go
 1  package msgmux
 2  
 3  import (
 4  	"github.com/btcsuite/btclog/v2"
 5  	"github.com/lightningnetwork/lnd/build"
 6  )
 7  
 8  // Subsystem defines the logging code for this subsystem.
 9  const Subsystem = "MSGX"
10  
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
13  // requests it.
14  var log btclog.Logger
15  
16  // The default amount of logging is none.
17  func init() {
18  	UseLogger(build.NewSubLogger(Subsystem, nil))
19  }
20  
21  // DisableLog disables all library log output.  Logging output is disabled
22  // by default until UseLogger is called.
23  func DisableLog() {
24  	UseLogger(btclog.Disabled)
25  }
26  
27  // UseLogger uses a specified Logger to output package logging info.
28  // This should be used in preference to SetLogWriter if the caller is also
29  // using btclog.
30  func UseLogger(logger btclog.Logger) {
31  	log = logger
32  }