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,