github.com/decred/dcrlnd@v0.7.6/walletunlocker/log.go (about)

     1  package walletunlocker
     2  
     3  import (
     4  	"github.com/decred/dcrlnd/build"
     5  	"github.com/decred/slog"
     6  )
     7  
     8  // log is a logger that is initialized with no output filters.  This means the
     9  // package will not perform any logging by default until the caller requests
    10  // it.
    11  var log slog.Logger
    12  
    13  // The default amount of logging is none.
    14  func init() {
    15  	UseLogger(build.NewSubLogger("WUNL", nil))
    16  }
    17  
    18  // DisableLog disables all library log output.  Logging output is disabled by
    19  // default until UseLogger is called.
    20  func DisableLog() {
    21  	UseLogger(slog.Disabled)
    22  }
    23  
    24  // UseLogger uses a specified Logger to output package logging info.  This
    25  // should be used in preference to SetLogWriter if the caller is also using
    26  // slog.
    27  func UseLogger(logger slog.Logger) {
    28  	log = logger
    29  }