github.com/decred/dcrlnd@v0.7.6/lnwallet/dcrwallet/loader/log.go (about)

     1  // Copyright (c) 2015 The btcsuite developers
     2  // Copyright (c) 2017-2018 The Decred developers
     3  // Use of this source code is governed by an ISC
     4  // license that can be found in the LICENSE file.
     5  
     6  package loader
     7  
     8  import "github.com/decred/slog"
     9  
    10  // log is a logger that is initialized with no output filters.  This
    11  // means the package will not perform any logging by default until the caller
    12  // requests it.
    13  var log slog.Logger
    14  
    15  // The default amount of logging is none.
    16  func init() {
    17  	DisableLog()
    18  }
    19  
    20  // DisableLog disables all library log output.  Logging output is disabled
    21  // by default until either UseLogger or SetLogWriter are called.
    22  func DisableLog() {
    23  	log = slog.Disabled
    24  }
    25  
    26  // UseLogger uses a specified Logger to output package logging info.
    27  // This should be used in preference to SetLogWriter if the caller is also
    28  // using slog.
    29  func UseLogger(logger slog.Logger) {
    30  	log = logger
    31  }