From 6da419e684fdc536e78b1b1032fbe713e10552d3 Mon Sep 17 00:00:00 2001 From: mstmdev Date: Sun, 28 May 2023 03:08:40 +0800 Subject: [PATCH] Auto flush logs to file per 3 seconds by default (#15) --- file_logger.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file_logger.go b/file_logger.go index b232e5d..6c2730c 100644 --- a/file_logger.go +++ b/file_logger.go @@ -48,9 +48,9 @@ type logMsg struct { flush bool } -// NewFileLogger get a file logger +// NewFileLogger get a default file logger, auto flush logs to file per 3 seconds by default func NewFileLogger(lvl level.Level, logDir string, filePrefix string) (Logger, error) { - return NewFileLoggerWithAutoFlush(lvl, logDir, filePrefix, false, time.Duration(0)) + return NewFileLoggerWithAutoFlush(lvl, logDir, filePrefix, true, time.Second*3) } // NewFileLoggerWithAutoFlush get a file logger