825 B
825 B
logging
日志组件
使用说明
日志组件封装了uber/zap,使用基本一致
package main
import(
"git.hpds.cc/Component/logging"
"go.uber.org/zap/zap"
)
func main(){
logger := LoadLoggerConfig()
logger.Info("this is a test log")
//也可以这样直接使用
logging.L().Info("this is a test log")
}
// LoadLoggerConfig 加载日志配置
func LoadLoggerConfig() *logging.Logger {
return logging.NewLogger(
logging.SetPath("./log/"),
logging.SetPrefix(""),
logging.SetDevelopment(true),
logging.SetDebugFileSuffix(""),
logging.SetWarnFileSuffix(""),
logging.SetErrorFileSuffix(""),
logging.SetInfoFileSuffix(""),
logging.SetMaxAge(30),
logging.SetMaxBackups(100),
logging.SetMaxSize(100),
logging.SetLevel(logging.LogLevel["debug"]),
)
}