修改日志

main
lzf 2024-09-30 15:41:29 +08:00
parent 85d7510113
commit fb4fee6e30
1 changed files with 17 additions and 2 deletions

View File

@ -26,6 +26,9 @@ var (
"ERROR": zapcore.ErrorLevel,
"FATAL": zapcore.FatalLevel,
}
defaultLogLevel = DebugLevel
// DefaultConfig 默认配置
DefaultConfig = &Config{
Level: DebugLevel,
@ -63,8 +66,20 @@ type (
}
)
// Init 覆盖默认日志
func Init(serverName string, config *Config) {
func SetLogLevel(level string) {
defaultLogLevel = level
}
func Init() {
globalLog = NewLogger("debug", &Config{
Level: defaultLogLevel,
NeedLogFile: false,
ConsoleWriter: os.Stdout,
})
}
// InitWithConfig 覆盖默认日志
func InitWithConfig(serverName string, config *Config) {
globalLog = NewLogger(serverName, config)
}