diff --git a/file_logger.go b/file_logger.go index cc7a6d2..b232e5d 100644 --- a/file_logger.go +++ b/file_logger.go @@ -55,13 +55,7 @@ func NewFileLogger(lvl level.Level, logDir string, filePrefix string) (Logger, e // NewFileLoggerWithAutoFlush get a file logger func NewFileLoggerWithAutoFlush(lvl level.Level, logDir string, filePrefix string, autoFlush bool, flushInterval time.Duration) (Logger, error) { - return NewFileLoggerWithOption(option.FileLoggerOption{ - Level: lvl, - LogDir: logDir, - FilePrefix: filePrefix, - AutoFlush: autoFlush, - FlushInterval: flushInterval, - }) + return NewFileLoggerWithOption(option.NewFileLoggerOption(lvl, logDir, filePrefix, autoFlush, flushInterval, false)) } // NewFileLoggerWithOption get a file logger with option diff --git a/option/file_logger_option.go b/option/file_logger_option.go index 49d3908..63ff33c 100644 --- a/option/file_logger_option.go +++ b/option/file_logger_option.go @@ -15,3 +15,15 @@ type FileLoggerOption struct { FlushInterval time.Duration SplitDate bool } + +// NewFileLoggerOption returns an instance of the FileLoggerOption +func NewFileLoggerOption(lvl level.Level, logDir string, filePrefix string, autoFlush bool, flushInterval time.Duration, splitDate bool) FileLoggerOption { + return FileLoggerOption{ + Level: lvl, + LogDir: logDir, + FilePrefix: filePrefix, + AutoFlush: autoFlush, + FlushInterval: flushInterval, + SplitDate: splitDate, + } +}