logger 支持动态设置日志级别

This commit is contained in:
Shikong 2023-02-24 01:09:01 +08:00
parent 8365c1b98f
commit 15a71eadef

View File

@ -7,11 +7,11 @@ import (
) )
func TestLogger(t *testing.T) { func TestLogger(t *testing.T) {
Logger().Debugf("%s", time.Now().Format("2006-01-02 15:04:05.999")) Logger().Debugf("%s", time.Now().Format("2006-01-02 15:04:05.000"))
Logger().Infof("%s", time.Now().Format("2006-01-02 15:04:05.999")) Logger().Infof("%s", time.Now().Format("2006-01-02 15:04:05.000"))
SetLevel(zapcore.InfoLevel) SetLevel(zapcore.InfoLevel)
Logger().Debugf("%s", time.Now().Format("2006-01-02 15:04:05.999")) Logger().Debugf("%s", time.Now().Format("2006-01-02 15:04:05.000"))
Logger().Infof("%s", time.Now().Format("2006-01-02 15:04:05.999")) Logger().Infof("%s", time.Now().Format("2006-01-02 15:04:05.000"))
} }