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

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