From 20a61ce43e7dd12660be98e074516ff91042876e Mon Sep 17 00:00:00 2001 From: chainlife <9183838@qq.com> Date: Mon, 2 Jan 2023 23:22:13 +0800 Subject: [PATCH] logx conf add DisableStat (#2434) Co-authored-by: sunsoft --- core/logx/config.go | 1 + core/logx/logs.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/logx/config.go b/core/logx/config.go index dd96b6eb..2d75549c 100644 --- a/core/logx/config.go +++ b/core/logx/config.go @@ -9,6 +9,7 @@ type LogConf struct { Path string `json:",default=logs"` Level string `json:",default=info,options=[debug,info,error,severe]"` Compress bool `json:",optional"` + DisableStat bool `json:",optional"` KeepDays int `json:",optional"` StackCooldownMillis int `json:",default=100"` // MaxBackups represents how many backup log files will be kept. 0 means all files will be kept forever. diff --git a/core/logx/logs.go b/core/logx/logs.go index 621b1ee3..07f200e9 100644 --- a/core/logx/logs.go +++ b/core/logx/logs.go @@ -229,7 +229,11 @@ func SetUp(c LogConf) (err error) { // Need to wait for the first caller to complete the execution. setupOnce.Do(func() { setupLogLevel(c) - + + if (c.DisableStat){ + DisableStat() + } + if len(c.TimeFormat) > 0 { timeFormat = c.TimeFormat }