From 98d31071491532f08e89f1ed786f691add7f5edf Mon Sep 17 00:00:00 2001 From: xc Date: Mon, 1 Sep 2025 14:07:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scagent/util/xttlog.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scagent/util/xttlog.go b/scagent/util/xttlog.go index 20ce397..8ab8dd8 100644 --- a/scagent/util/xttlog.go +++ b/scagent/util/xttlog.go @@ -60,3 +60,12 @@ func NewProductionLogger() *zap.Logger { return logger } + +// 根据环境初始化日志器 +func InitLogger(env string) *zap.Logger { + if env == "dev" { + logger, _ := zap.NewDevelopment() + return logger + } + return NewProductionLogger() +}