日志组件
Go to file Use this template
wangjian bcd0f31019 modify readme, add example 2022-08-02 14:44:32 +08:00
README.md modify readme, add example 2022-07-13 17:14:38 +08:00
go.mod modify readme, add example 2022-08-02 14:44:32 +08:00
logger.go modify readme, add example 2022-07-13 17:14:38 +08:00

README.md

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"]),
	)
}