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

     1  package chanfitness
     2  
     3  import (
     4  	"github.com/decred/dcrlnd/build"
     5  	"github.com/decred/slog"
     6  )
     7  
     8  // Subsystem defines the logging code for this subsystem.
     9  const Subsystem = "CHFT"
    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 slog.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(slog.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 slog.
    30  func UseLogger(logger slog.Logger) {
    31  	log = logger
    32  }