From 8e6ff1a7e7bb23817fe9013be8704ac85bfa3ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Tue, 14 Dec 2021 11:08:57 +0800 Subject: [PATCH] :bug: fix a bug. --- logger.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/logger.go b/logger.go index 88be016..dd6024c 100644 --- a/logger.go +++ b/logger.go @@ -8,6 +8,11 @@ import ( var config LogConfig var Say *zap.SugaredLogger +// 避免异常,在第一次调用时初始化一个只打印到控制台的logger +func init() { + InitLogger(LogConfig{Mode: Dev, LokiEnable: false, FileEnable: false}) +} + // InitLogger 初始化日志工具 func InitLogger(c LogConfig) { config = c