From b3679f72707f117c25c1d7c0e71ee7e8d0930697 Mon Sep 17 00:00:00 2001 From: nikkiing <1031497516@qq.com> Date: Wed, 22 Feb 2023 16:37:27 +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/logger.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/glog/v1/logger.go b/glog/v1/logger.go index 3d4b702..6daf62b 100644 --- a/glog/v1/logger.go +++ b/glog/v1/logger.go @@ -13,11 +13,11 @@ type Logger interface { } type LoggerConfig struct { - env string - id string - name string - version string - aliLogConfig AliLogConfig + Env string + Id string + Name string + Version string + AliLogConfig AliLogConfig } type AliLogConfig struct { @@ -32,28 +32,28 @@ func NewLogger(c *LoggerConfig) (log.Logger, func()) { var l Logger - switch c.env { + switch c.Env { default: l = NewStdLogger(os.Stdout) case enum.EnvLocal: l = NewStdLogger(os.Stdout) case enum.EnvDevelop, enum.EnvPre, enum.EnvProduct: l = NewAliyunLog( - WithAccessKey(c.aliLogConfig.AccessKey), - WithAccessSecret(c.aliLogConfig.AccessSecret), - WithEndpoint(c.aliLogConfig.Endpoint), - WithProject(c.aliLogConfig.Project), - WithLogstore(c.aliLogConfig.LogStore), + WithAccessKey(c.AliLogConfig.AccessKey), + WithAccessSecret(c.AliLogConfig.AccessSecret), + WithEndpoint(c.AliLogConfig.Endpoint), + WithProject(c.AliLogConfig.Project), + WithLogstore(c.AliLogConfig.LogStore), ) } logger := log.With(l, "ts", log.DefaultTimestamp, "caller", log.DefaultCaller, - "env", c.env, - "service.id", "id", - "service.name", "Name", - "service.version", "Version", + "env", c.Env, + "service.id", c.Id, + "service.name", c.Name, + "service.version", c.Version, "trace.id", tracing.TraceID(), "span.id", tracing.SpanID(), )