修改日志
parent
85d7510113
commit
fb4fee6e30
19
mylog/log.go
19
mylog/log.go
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue