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

     1  package keychain
     2  
     3  import (
     4  	"github.com/decred/dcrlnd/build"
     5  	"github.com/decred/slog"
     6  )
     7  
     8  // keychainLog is a logger that is initialized with no output filters.  This
     9  // means the package will not perform any logging by default until the caller
    10  // requests it.
    11  var keychainLog slog.Logger // nolint: unused
    12  
    13  // The default amount of logging is none.
    14  func init() {
    15  	UseLogger(build.NewSubLogger("KCHN", nil))
    16  }
    17  
    18  // DisableLog disables all library log output.  Logging output is disabled
    19  // by 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.
    25  // This should be used in preference to SetLogWriter if the caller is also
    26  // using slog.
    27  func UseLogger(logger slog.Logger) {
    28  	keychainLog = logger
    29  }