github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/logging/global.go (about)

     1  package logging
     2  
     3  var global = Noop()
     4  
     5  // Global returns the global logger.
     6  func Global() Interface {
     7  	return global
     8  }
     9  
    10  // SetGlobal sets the global logger.
    11  func SetGlobal(i Interface) {
    12  	global = i
    13  }
    14  
    15  // Debugf convenience function calls the global loggerr.
    16  func Debugf(format string, args ...interface{}) {
    17  	global.Debugf(format, args...)
    18  }
    19  
    20  // Debugln convenience function calls the global logger.
    21  func Debugln(args ...interface{}) {
    22  	global.Debugln(args...)
    23  }
    24  
    25  // Infof convenience function calls the global logger.
    26  func Infof(format string, args ...interface{}) {
    27  	global.Infof(format, args...)
    28  }
    29  
    30  // Infoln convenience function calls the global logger.
    31  func Infoln(args ...interface{}) {
    32  	global.Infoln(args...)
    33  }
    34  
    35  // Warnf convenience function calls the global logger.
    36  func Warnf(format string, args ...interface{}) {
    37  	global.Warnf(format, args...)
    38  }
    39  
    40  // Warnln convenience function calls the global logger.
    41  func Warnln(args ...interface{}) {
    42  	global.Warnln(args...)
    43  }
    44  
    45  // Errorf convenience function calls the global logger.
    46  func Errorf(format string, args ...interface{}) {
    47  	global.Errorf(format, args...)
    48  }
    49  
    50  // Errorln convenience function calls the global logger.
    51  func Errorln(args ...interface{}) {
    52  	global.Errorln(args...)
    53  }
    54  
    55  // WithField convenience function calls the global logger.
    56  func WithField(key string, value interface{}) Interface {
    57  	return global.WithField(key, value)
    58  }