From 2c221193af322b19438913e64dfa402617704753 Mon Sep 17 00:00:00 2001 From: nikkiing <1031497516@qq.com> Date: Wed, 22 Feb 2023 17:14:55 +0800 Subject: [PATCH] =?UTF-8?q?env=E5=92=8C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- glog/v1/glog.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/glog/v1/glog.go b/glog/v1/glog.go index 6b7b4fd..2156ce8 100644 --- a/glog/v1/glog.go +++ b/glog/v1/glog.go @@ -1,9 +1,17 @@ package glog -import "github.com/go-kratos/kratos/v2/log" +import ( + "github.com/go-kratos/kratos/v2/log" + "sync" +) -var Glog *log.Helper +var ( + once sync.Once + Glog *log.Helper +) func NewHelper(logger log.Logger) { - Glog = log.NewHelper(logger) + once.Do(func() { + Glog = log.NewHelper(logger) + }) }