From 22729da9f5f7467ad19e4c3193edd07a990702f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=8D=A3=E6=98=8C?= Date: Sun, 7 Apr 2024 14:19:18 +0800 Subject: [PATCH] fix: rename default log --- log/kis_default_log.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/log/kis_default_log.go b/log/kis_default_log.go index 671222f..ac2c31a 100644 --- a/log/kis_default_log.go +++ b/log/kis_default_log.go @@ -17,8 +17,8 @@ func init() { } func MustNewKisDefaultSlog(opts ...KisLogOptions) { - initDefaultSlog(loadKisDefaultLog(opts...)) - SetLogger(&kisDefaultSlog{}) + defaultSlog := getKisDefaultSLog(opts...) + SetLogger(defaultSlog) } // kisDefaultSlog 默认提供的日志对象 @@ -64,17 +64,18 @@ var defaultKisLog = &kisDefaultSlog{ writer: os.Stdout, } -func loadKisDefaultLog(opts ...KisLogOptions) *kisDefaultSlog { - kisLog := defaultKisLog +func getKisDefaultSLog(opts ...KisLogOptions) *kisDefaultSlog { + defaultKisSlog := defaultKisLog if opts == nil { - return kisLog + return defaultKisSlog } for _, opt := range opts { - opt(kisLog) + opt(defaultKisSlog) } - return kisLog + initDefaultSlog(defaultKisSlog) + return defaultKisSlog } func (k *kisDefaultSlog) InfoFX(ctx context.Context, str string, v ...interface{}) {