codeberg.org/gruf/go-log@v1.0.6-0.20231202001801-031c3d3d089b/default.go (about)

     1  package log
     2  
     3  import (
     4  	"io"
     5  	"log"
     6  
     7  	"codeberg.org/gruf/go-kv"
     8  )
     9  
    10  func init() {
    11  	// Init global + set default flags
    12  	global = NewFrom(log.Default(), 1)
    13  	global.Logger().SetFlags(stdflags)
    14  }
    15  
    16  // global is the global Logger instance built using log's default.
    17  var global *Logger
    18  
    19  // Default returns the default Logger instance.
    20  func Default() *Logger { return global }
    21  
    22  /* below are direct call-throughs to global Logger. */
    23  
    24  func Debug(a ...interface{})                                    { global.Debug(a...) }
    25  func Debugf(s string, a ...interface{})                         { global.Debugf(s, a...) }
    26  func DebugFields(fields ...kv.Field)                            { global.DebugFields(fields...) }
    27  func Info(a ...interface{})                                     { global.Info(a...) }
    28  func Infof(s string, a ...interface{})                          { global.Infof(s, a...) }
    29  func InfoFields(fields ...kv.Field)                             { global.InfoFields(fields...) }
    30  func Warn(a ...interface{})                                     { global.Warn(a...) }
    31  func Warnf(s string, a ...interface{})                          { global.Warnf(s, a...) }
    32  func WarnFields(fields ...kv.Field)                             { global.WarnFields(fields...) }
    33  func Error(a ...interface{})                                    { global.Error(a...) }
    34  func Errorf(s string, a ...interface{})                         { global.Errorf(s, a...) }
    35  func ErrorFields(fields ...kv.Field)                            { global.ErrorFields(fields...) }
    36  func Panic(a ...interface{})                                    { global.Panic(a...) }
    37  func Panicf(s string, a ...interface{})                         { global.Panicf(s, a...) }
    38  func PanicFields(fields ...kv.Field)                            { global.PanicFields(fields...) }
    39  func Log(calldepth int, lvl LEVEL, a ...interface{})            { global.Log(calldepth, lvl, a...) }
    40  func Logf(calldepth int, lvl LEVEL, s string, a ...interface{}) { global.Logf(calldepth, lvl, s, a...) }
    41  func LogFields(calldepth int, lvl LEVEL, fields ...kv.Field) {
    42  	global.LogFields(calldepth, lvl, fields...)
    43  }
    44  func Print(a ...interface{})            { global.Print(a...) }
    45  func Printf(s string, a ...interface{}) { global.Printf(s, a...) }
    46  func PrintFields(fields ...kv.Field)    { global.PrintFields(fields...) }
    47  func Level() LEVEL                      { return global.Level() }
    48  func SetLevel(lvl LEVEL)                { global.SetLevel(lvl) }
    49  func IncludeCaller() bool               { return global.IncludeCaller() }
    50  func SetIncludeCaller(verbose bool)     { global.SetIncludeCaller(verbose) }
    51  func SetOutput(out io.Writer)           { global.SetOutput(out) }