From 851c81dd5263b7df5ba2e1aa0297e54cb7867dab Mon Sep 17 00:00:00 2001 From: Shikong <919411476@qq.com> Date: Thu, 7 Oct 2021 00:18:50 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=89=8B=E5=8A=A8=E5=AE=9E=E7=8E=B0=20?= =?UTF-8?q?simple=20log=20=E6=97=A5=E5=BF=97=E5=BA=93=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=88=86=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simplelog/simplelog.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simplelog/simplelog.go b/simplelog/simplelog.go index 8eb3d4b..8afa526 100644 --- a/simplelog/simplelog.go +++ b/simplelog/simplelog.go @@ -73,7 +73,7 @@ func (l *Logger) PrintLog(level LogLevel, log string) { file := l.w.(*os.File) info, _ := file.Stat() currentSize := uint64(info.Size()) - if currentSize < l.splitSize { + if l.splitSize == 0 || currentSize < l.splitSize { break } else { _ = file.Close() @@ -193,7 +193,7 @@ func WithSplitSize(size uint64) OptionFunc { var defaultOption = &Option{ Writer: os.Stdout, TimeFormat: "2006-01-02 15:04:05.99", - LogFormat: "%-22s %s %v --- [%20s] : %s\n", + LogFormat: "%-22s %-5s %v --- [%20s] : %s\n", LevelFlag: FlagInfo | FlagWarn | FlagError | FlagDebug, LogFile: "", SplitSize: 0,