github.com/Aoi-hosizora/ahlib-more@v1.5.1-0.20230404072844-256112befaf6/xlogger/xlogger.go (about) 1 package xlogger 2 3 import ( 4 "log" 5 _ "unsafe" 6 ) 7 8 //go:linkname std log.std 9 10 // std is the unexported standard logger `log.std`, this value can be created by log.Default. 11 var std *log.Logger 12 13 // Std returns the unexported default logger, this value can be created by log.Default. 14 func Std() *log.Logger { 15 return std 16 } 17 18 var _ StdLogger = (*log.Logger)(nil) 19 20 // StdLogger describes how log.Logger works like, includes Print, Panic, Fatal series methods. 21 type StdLogger interface { 22 Print(v ...interface{}) 23 Printf(format string, v ...interface{}) 24 Println(v ...interface{}) 25 26 Panic(v ...interface{}) 27 Panicf(format string, v ...interface{}) 28 Panicln(v ...interface{}) 29 30 Fatal(v ...interface{}) 31 Fatalf(format string, v ...interface{}) 32 Fatalln(v ...interface{}) 33 }