github.com/sandwich-go/boost@v1.3.29/boost.go (about) 1 package boost 2 3 import ( 4 "fmt" 5 6 "github.com/sandwich-go/boost/internal/log" 7 ) 8 9 // InstallLogger 安装 log.Logger 10 func InstallLogger(logger log.Logger) { 11 log.Default = logger 12 } 13 14 // LogErrorAndEatError 输出 err 15 func LogErrorAndEatError(err error) { 16 if err != nil { 17 log.Error(err.Error()) 18 } 19 } 20 21 // LogDebug 输出 info 22 func LogDebug(msg string) { log.Debug(msg) } 23 func LogDebugf(format string, a ...interface{}) { LogDebug(fmt.Sprintf(format, a...)) } 24 25 // LogInfo 输出 info 26 func LogInfo(msg string) { log.Info(msg) } 27 func LogInfof(format string, a ...interface{}) { LogInfo(fmt.Sprintf(format, a...)) } 28 29 // LogWarn 输出 info 30 func LogWarn(msg string) { log.Warn(msg) } 31 func LogWarnf(format string, a ...interface{}) { LogWarn(fmt.Sprintf(format, a...)) } 32 33 // LogError 输出 info 34 func LogError(msg string) { log.Error(msg) } 35 func LogErrorf(format string, a ...interface{}) { LogError(fmt.Sprintf(format, a...)) } 36 37 // LogFatal 输出 info 38 func LogFatal(msg string) { log.Fatal(msg) } 39 func LogFatalf(format string, a ...interface{}) { LogFatal(fmt.Sprintf(format, a...)) }