diff --git a/cfg_parser.go b/cfg_parser.go
index 7fb9aab..8f27940 100644
--- a/cfg_parser.go
+++ b/cfg_parser.go
@@ -83,6 +83,7 @@ const (
rollingFileDataPatternAttr = "datepattern"
rollingFileArchiveAttr = "archivetype"
rollingFileArchivePathAttr = "archivepath"
+ rollingFileArchiveExplodedAttr = "archiveexploded"
bufferedWriterID = "buffered"
bufferedSizeAttr = "size"
bufferedFlushPeriodAttr = "flushperiod"
@@ -1008,6 +1009,7 @@ func createRollingFileWriter(node *xmlNode, formatFromParent *formatter, formats
var rArchiveType rollingArchiveType
var rArchivePath string
+ var rArchiveExploded bool = false
if !archiveAttrExists {
rArchiveType = rollingArchiveNone
rArchivePath = ""
@@ -1020,12 +1022,28 @@ func createRollingFileWriter(node *xmlNode, formatFromParent *formatter, formats
if rArchiveType == rollingArchiveNone {
rArchivePath = ""
} else {
+ if rArchiveExplodedAttr, ok := node.attributes[rollingFileArchiveExplodedAttr]; ok {
+ if rArchiveExploded, err = strconv.ParseBool(rArchiveExplodedAttr); err != nil {
+ return nil, fmt.Errorf("archive exploded should be true or false, but was %v",
+ rArchiveExploded)
+ }
+ }
+
rArchivePath, ok = node.attributes[rollingFileArchivePathAttr]
- if !ok {
- rArchivePath, ok = rollingArchiveTypesDefaultNames[rArchiveType]
- if !ok {
- return nil, fmt.Errorf("cannot get default filename for archive type = %v",
- rArchiveType)
+ if ok {
+ if rArchivePath == "" {
+ return nil, fmt.Errorf("empty archive path is not supported")
+ }
+ } else {
+ if rArchiveExploded {
+ rArchivePath = rollingArchiveDefaultExplodedName
+
+ } else {
+ rArchivePath, ok = rollingArchiveTypesDefaultNames[rArchiveType]
+ if !ok {
+ return nil, fmt.Errorf("cannot get default filename for archive type = %v",
+ rArchiveType)
+ }
}
}
}
@@ -1045,7 +1063,7 @@ func createRollingFileWriter(node *xmlNode, formatFromParent *formatter, formats
if rollingType == rollingTypeSize {
err := checkUnexpectedAttribute(node, outputFormatID, rollingFileTypeAttr, rollingFilePathAttr,
rollingFileMaxSizeAttr, rollingFileMaxRollsAttr, rollingFileArchiveAttr,
- rollingFileArchivePathAttr, rollingFileNameModeAttr)
+ rollingFileArchivePathAttr, rollingFileArchiveExplodedAttr, rollingFileNameModeAttr)
if err != nil {
return nil, err
}
@@ -1069,7 +1087,7 @@ func createRollingFileWriter(node *xmlNode, formatFromParent *formatter, formats
}
}
- rollingWriter, err := NewRollingFileWriterSize(path, rArchiveType, rArchivePath, maxSize, maxRolls, nameMode)
+ rollingWriter, err := NewRollingFileWriterSize(path, rArchiveType, rArchivePath, maxSize, maxRolls, nameMode, rArchiveExploded)
if err != nil {
return nil, err
}
@@ -1079,7 +1097,7 @@ func createRollingFileWriter(node *xmlNode, formatFromParent *formatter, formats
} else if rollingType == rollingTypeTime {
err := checkUnexpectedAttribute(node, outputFormatID, rollingFileTypeAttr, rollingFilePathAttr,
rollingFileDataPatternAttr, rollingFileArchiveAttr, rollingFileMaxRollsAttr,
- rollingFileArchivePathAttr, rollingFileNameModeAttr)
+ rollingFileArchivePathAttr, rollingFileArchiveExplodedAttr, rollingFileNameModeAttr)
if err != nil {
return nil, err
}
@@ -1098,7 +1116,7 @@ func createRollingFileWriter(node *xmlNode, formatFromParent *formatter, formats
return nil, newMissingArgumentError(node.name, rollingFileDataPatternAttr)
}
- rollingWriter, err := NewRollingFileWriterTime(path, rArchiveType, rArchivePath, maxRolls, dataPattern, rollingIntervalAny, nameMode)
+ rollingWriter, err := NewRollingFileWriterTime(path, rArchiveType, rArchivePath, maxRolls, dataPattern, rollingIntervalAny, nameMode, rArchiveExploded)
if err != nil {
return nil, err
}
diff --git a/cfg_parser_test.go b/cfg_parser_test.go
index 9c6f9b8..ca4b194 100644
--- a/cfg_parser_test.go
+++ b/cfg_parser_test.go
@@ -269,7 +269,7 @@ func getParserTests() []parserTest {
testExpected = new(configForParsing)
testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
testExpected.Exceptions = nil
- testrollingFileWriter, _ := NewRollingFileWriterSize(testLogFileName, rollingArchiveNone, "", 100, 5, rollingNameModePostfix)
+ testrollingFileWriter, _ := NewRollingFileWriterSize(testLogFileName, rollingArchiveNone, "", 100, 5, rollingNameModePostfix, false)
testHeadSplitter, _ = NewSplitDispatcher(DefaultFormatter, []interface{}{testrollingFileWriter})
testExpected.LogType = syncloggerTypeFromString
testExpected.RootDispatcher = testHeadSplitter
@@ -286,7 +286,7 @@ func getParserTests() []parserTest {
testExpected = new(configForParsing)
testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
testExpected.Exceptions = nil
- testrollingFileWriter, _ = NewRollingFileWriterSize(testLogFileName, rollingArchiveZip, "log.zip", 100, 5, rollingNameModePostfix)
+ testrollingFileWriter, _ = NewRollingFileWriterSize(testLogFileName, rollingArchiveZip, "log.zip", 100, 5, rollingNameModePostfix, false)
testHeadSplitter, _ = NewSplitDispatcher(DefaultFormatter, []interface{}{testrollingFileWriter})
testExpected.LogType = syncloggerTypeFromString
testExpected.RootDispatcher = testHeadSplitter
@@ -303,7 +303,41 @@ func getParserTests() []parserTest {
testExpected = new(configForParsing)
testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
testExpected.Exceptions = nil
- testrollingFileWriter, _ = NewRollingFileWriterSize(testLogFileName, rollingArchiveZip, "test.zip", 100, 5, rollingNameModePrefix)
+ testrollingFileWriter, _ = NewRollingFileWriterSize(testLogFileName, rollingArchiveZip, "test.zip", 100, 5, rollingNameModePrefix, false)
+ testHeadSplitter, _ = NewSplitDispatcher(DefaultFormatter, []interface{}{testrollingFileWriter})
+ testExpected.LogType = syncloggerTypeFromString
+ testExpected.RootDispatcher = testHeadSplitter
+ parserTests = append(parserTests, parserTest{testName, testConfig, testExpected, false, nil})
+
+ testName = "Rolling file writer archive zip exploded"
+ testLogFileName = getTestFileName(testName, "")
+ testConfig = `
+
+
+
+
+ `
+ testExpected = new(configForParsing)
+ testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
+ testExpected.Exceptions = nil
+ testrollingFileWriter, _ = NewRollingFileWriterSize(testLogFileName, rollingArchiveZip, "old", 100, 5, rollingNameModePostfix , true)
+ testHeadSplitter, _ = NewSplitDispatcher(DefaultFormatter, []interface{}{testrollingFileWriter})
+ testExpected.LogType = syncloggerTypeFromString
+ testExpected.RootDispatcher = testHeadSplitter
+ parserTests = append(parserTests, parserTest{testName, testConfig, testExpected, false, nil})
+
+ testName = "Rolling file writer archive zip exploded with specified path"
+ testLogFileName = getTestFileName(testName, "")
+ testConfig = `
+
+
+
+
+ `
+ testExpected = new(configForParsing)
+ testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
+ testExpected.Exceptions = nil
+ testrollingFileWriter, _ = NewRollingFileWriterSize(testLogFileName, rollingArchiveZip, "test_old_logs", 100, 5, rollingNameModePrefix, true)
testHeadSplitter, _ = NewSplitDispatcher(DefaultFormatter, []interface{}{testrollingFileWriter})
testExpected.LogType = syncloggerTypeFromString
testExpected.RootDispatcher = testHeadSplitter
@@ -320,7 +354,7 @@ func getParserTests() []parserTest {
testExpected = new(configForParsing)
testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
testExpected.Exceptions = nil
- testrollingFileWriter, _ = NewRollingFileWriterSize(testLogFileName, rollingArchiveNone, "", 100, 5, rollingNameModePostfix)
+ testrollingFileWriter, _ = NewRollingFileWriterSize(testLogFileName, rollingArchiveNone, "", 100, 5, rollingNameModePostfix, false)
testHeadSplitter, _ = NewSplitDispatcher(DefaultFormatter, []interface{}{testrollingFileWriter})
testExpected.LogType = syncloggerTypeFromString
testExpected.RootDispatcher = testHeadSplitter
@@ -337,7 +371,7 @@ func getParserTests() []parserTest {
testExpected = new(configForParsing)
testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
testExpected.Exceptions = nil
- testrollingFileWriterTime, _ := NewRollingFileWriterTime(testLogFileName, rollingArchiveNone, "", 0, "2006-01-02T15:04:05Z07:00", rollingIntervalAny, rollingNameModePostfix)
+ testrollingFileWriterTime, _ := NewRollingFileWriterTime(testLogFileName, rollingArchiveNone, "", 0, "2006-01-02T15:04:05Z07:00", rollingIntervalAny, rollingNameModePostfix, false)
testHeadSplitter, _ = NewSplitDispatcher(DefaultFormatter, []interface{}{testrollingFileWriterTime})
testExpected.LogType = syncloggerTypeFromString
testExpected.RootDispatcher = testHeadSplitter
@@ -356,7 +390,7 @@ func getParserTests() []parserTest {
testExpected = new(configForParsing)
testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
testExpected.Exceptions = nil
- testrollingFileWriterTime, _ = NewRollingFileWriterTime(testLogFileName, rollingArchiveNone, "", 0, "2006-01-02T15:04:05Z07:00", rollingIntervalDaily, rollingNameModePostfix)
+ testrollingFileWriterTime, _ = NewRollingFileWriterTime(testLogFileName, rollingArchiveNone, "", 0, "2006-01-02T15:04:05Z07:00", rollingIntervalDaily, rollingNameModePostfix, false)
testbufferedWriter, _ := NewBufferedWriter(testrollingFileWriterTime, 100500, 100)
testHeadSplitter, _ = NewSplitDispatcher(DefaultFormatter, []interface{}{testbufferedWriter})
testExpected.LogType = syncloggerTypeFromString
@@ -987,6 +1021,16 @@ func getParserTests() []parserTest {
`
parserTests = append(parserTests, parserTest{testName, testConfig, nil, true, nil})
+ testName = "Errors #27"
+ testLogFileName = getTestFileName(testName, "")
+ testConfig = `
+
+
+
+
+ `
+ parserTests = append(parserTests, parserTest{testName, testConfig, nil, true, nil})
+
testName = "Buffered writer same formatid override"
testLogFileName = getTestFileName(testName, "")
testConfig = `
@@ -1003,7 +1047,7 @@ func getParserTests() []parserTest {
testExpected = new(configForParsing)
testExpected.Constraints, _ = NewMinMaxConstraints(TraceLvl, CriticalLvl)
testExpected.Exceptions = nil
- testrollingFileWriterTime, _ = NewRollingFileWriterTime(testLogFileName, rollingArchiveNone, "", 0, "2006-01-02T15:04:05Z07:00", rollingIntervalDaily, rollingNameModePrefix)
+ testrollingFileWriterTime, _ = NewRollingFileWriterTime(testLogFileName, rollingArchiveNone, "", 0, "2006-01-02T15:04:05Z07:00", rollingIntervalDaily, rollingNameModePrefix, false)
testbufferedWriter, _ = NewBufferedWriter(testrollingFileWriterTime, 100500, 100)
testFormat, _ = NewFormatter("%Level %Msg %File 123")
formattedWriter, _ = NewFormattedWriter(testbufferedWriter, testFormat)
diff --git a/writers_filewriter_test.go b/writers_filewriter_test.go
index 1893be8..b070c8a 100644
--- a/writers_filewriter_test.go
+++ b/writers_filewriter_test.go
@@ -52,19 +52,22 @@ func simplefileWriterGetter(testCase *fileWriterTestCase) (io.WriteCloser, error
//===============================================================
type fileWriterTestCase struct {
- files []string
- fileName string
- rollingType rollingType
- fileSize int64
- maxRolls int
- datePattern string
- writeCount int
- resFiles []string
- nameMode rollingNameMode
+ files []string
+ fileName string
+ rollingType rollingType
+ fileSize int64
+ maxRolls int
+ datePattern string
+ writeCount int
+ resFiles []string
+ nameMode rollingNameMode
+ archiveType rollingArchiveType
+ archiveExploded bool
+ archivePath string
}
func createSimplefileWriterTestCase(fileName string, writeCount int) *fileWriterTestCase {
- return &fileWriterTestCase{[]string{}, fileName, rollingTypeSize, 0, 0, "", writeCount, []string{fileName}, 0}
+ return &fileWriterTestCase{[]string{}, fileName, rollingTypeSize, 0, 0, "", writeCount, []string{fileName}, 0, rollingArchiveNone, false, ""}
}
var simplefileWriterTests = []*fileWriterTestCase{
@@ -90,7 +93,7 @@ func NewFileWriterTester(
}
func isWriterTestFile(fn string) bool {
- return strings.Contains(fn, ".testlog")
+ return strings.Contains(fn, ".testlog") || strings.Contains(fn, ".zip")
}
func cleanupWriterTest(t *testing.T) {
diff --git a/writers_rollingfilewriter.go b/writers_rollingfilewriter.go
index 2422a67..f2b2c75 100644
--- a/writers_rollingfilewriter.go
+++ b/writers_rollingfilewriter.go
@@ -28,6 +28,7 @@ import (
"fmt"
"io/ioutil"
"os"
+ "path"
"path/filepath"
"sort"
"strconv"
@@ -120,6 +121,10 @@ var rollingArchiveTypesStringRepresentation = map[rollingArchiveType]string{
rollingArchiveZip: "zip",
}
+var rollingArchiveTypesExtension = map[rollingArchiveType]string {
+ rollingArchiveZip: ".zip",
+}
+
func rollingArchiveTypeFromString(rollingArchiveTypeStr string) (rollingArchiveType, bool) {
for tp, tpStr := range rollingArchiveTypesStringRepresentation {
if tpStr == rollingArchiveTypeStr {
@@ -131,6 +136,8 @@ func rollingArchiveTypeFromString(rollingArchiveTypeStr string) (rollingArchiveT
}
// Default names for different archivation types
+var rollingArchiveDefaultExplodedName = "old"
+
var rollingArchiveTypesDefaultNames = map[rollingArchiveType]string{
rollingArchiveZip: "log.zip",
}
@@ -162,12 +169,13 @@ type rollingFileWriter struct {
rollingType rollingType // Rolling mode (Files roll by size/date/...)
archiveType rollingArchiveType
archivePath string
+ archiveExploded bool
maxRolls int
nameMode rollingNameMode
self rollerVirtual // Used for virtual calls
}
-func newRollingFileWriter(fpath string, rtype rollingType, atype rollingArchiveType, apath string, maxr int, namemode rollingNameMode) (*rollingFileWriter, error) {
+func newRollingFileWriter(fpath string, rtype rollingType, atype rollingArchiveType, apath string, maxr int, namemode rollingNameMode, archiveExploded bool) (*rollingFileWriter, error) {
rw := new(rollingFileWriter)
rw.currentDirPath, rw.fileName = filepath.Split(fpath)
if len(rw.currentDirPath) == 0 {
@@ -180,6 +188,7 @@ func newRollingFileWriter(fpath string, rtype rollingType, atype rollingArchiveT
rw.archivePath = apath
rw.nameMode = namemode
rw.maxRolls = maxr
+ rw.archiveExploded = archiveExploded
return rw, nil
}
@@ -281,40 +290,65 @@ func (rw *rollingFileWriter) deleteOldRolls(history []string) error {
switch rw.archiveType {
case rollingArchiveZip:
- var files map[string][]byte
+ if rw.archiveExploded {
+ os.MkdirAll(rw.archivePath, defaultDirectoryPermissions)
+
+ // Archive logs
+ for i := 0; i < rollsToDelete; i++ {
+ rollPath := filepath.Join(rw.currentDirPath, history[i])
+ bts, err := ioutil.ReadFile(rollPath)
+ if err != nil {
+ return err
+ }
+
+ entry := make(map[string][]byte)
+ entry[history[i]] = bts
+ archiveFile := path.Clean(rw.archivePath + "/" + history[i] + rollingArchiveTypesExtension[rollingArchiveZip])
+
+ // zip entry
+ if err = createZip(archiveFile, entry); err != nil {
+ return err
+ }
- // If archive exists
- _, err := os.Lstat(rw.archivePath)
- if nil == err {
- // Extract files and content from it
- files, err = unzip(rw.archivePath)
- if err != nil {
- return err
}
- // Remove the original file
- err = tryRemoveFile(rw.archivePath)
- if err != nil {
- return err
- }
} else {
- files = make(map[string][]byte)
- }
-
- // Add files to the existing files map, filled above
- for i := 0; i < rollsToDelete; i++ {
- rollPath := filepath.Join(rw.currentDirPath, history[i])
- bts, err := ioutil.ReadFile(rollPath)
- if err != nil {
- return err
+ var files map[string][]byte
+ os.MkdirAll(path.Dir(rw.archivePath), defaultDirectoryPermissions)
+
+ // If archive exists
+ _, err := os.Lstat(rw.archivePath)
+ if nil == err {
+ // Extract files and content from it
+ files, err = unzip(rw.archivePath)
+ if err != nil {
+ return err
+ }
+
+ // Remove the original file
+ err = tryRemoveFile(rw.archivePath)
+ if err != nil {
+ return err
+ }
+ } else {
+ files = make(map[string][]byte)
}
- files[rollPath] = bts
- }
+ // Add files to the existing files map, filled above
+ for i := 0; i < rollsToDelete; i++ {
+ rollPath := filepath.Join(rw.currentDirPath, history[i])
+ bts, err := ioutil.ReadFile(rollPath)
+ if err != nil {
+ return err
+ }
- // Put the final file set to zip file.
- if err = createZip(rw.archivePath, files); err != nil {
- return err
+ files[rollPath] = bts
+ }
+
+ // Put the final file set to zip file.
+ if err = createZip(rw.archivePath, files); err != nil {
+ return err
+ }
}
}
var err error
@@ -450,8 +484,8 @@ type rollingFileWriterSize struct {
maxFileSize int64
}
-func NewRollingFileWriterSize(fpath string, atype rollingArchiveType, apath string, maxSize int64, maxRolls int, namemode rollingNameMode) (*rollingFileWriterSize, error) {
- rw, err := newRollingFileWriter(fpath, rollingTypeSize, atype, apath, maxRolls, namemode)
+func NewRollingFileWriterSize(fpath string, atype rollingArchiveType, apath string, maxSize int64, maxRolls int, namemode rollingNameMode, archiveExploded bool) (*rollingFileWriterSize, error) {
+ rw, err := newRollingFileWriter(fpath, rollingTypeSize, atype, apath, maxRolls, namemode, archiveExploded)
if err != nil {
return nil, err
}
@@ -522,9 +556,9 @@ type rollingFileWriterTime struct {
}
func NewRollingFileWriterTime(fpath string, atype rollingArchiveType, apath string, maxr int,
- timePattern string, interval rollingIntervalType, namemode rollingNameMode) (*rollingFileWriterTime, error) {
+ timePattern string, interval rollingIntervalType, namemode rollingNameMode, archiveExploded bool) (*rollingFileWriterTime, error) {
- rw, err := newRollingFileWriter(fpath, rollingTypeTime, atype, apath, maxr, namemode)
+ rw, err := newRollingFileWriter(fpath, rollingTypeTime, atype, apath, maxr, namemode, archiveExploded)
if err != nil {
return nil, err
}
diff --git a/writers_rollingfilewriter_test.go b/writers_rollingfilewriter_test.go
index 9ca91ae..1da50a1 100644
--- a/writers_rollingfilewriter_test.go
+++ b/writers_rollingfilewriter_test.go
@@ -39,9 +39,12 @@ func createRollingSizeFileWriterTestCase(
maxRolls int,
writeCount int,
resFiles []string,
- nameMode rollingNameMode) *fileWriterTestCase {
+ nameMode rollingNameMode,
+ archiveType rollingArchiveType,
+ archiveExploded bool,
+ archivePath string) *fileWriterTestCase {
- return &fileWriterTestCase{files, fileName, rollingTypeSize, fileSize, maxRolls, "", writeCount, resFiles, nameMode}
+ return &fileWriterTestCase{files, fileName, rollingTypeSize, fileSize, maxRolls, "", writeCount, resFiles, nameMode, archiveType, archiveExploded, archivePath}
}
func createRollingDatefileWriterTestCase(
@@ -50,9 +53,12 @@ func createRollingDatefileWriterTestCase(
datePattern string,
writeCount int,
resFiles []string,
- nameMode rollingNameMode) *fileWriterTestCase {
+ nameMode rollingNameMode,
+ archiveType rollingArchiveType,
+ archiveExploded bool,
+ archivePath string) *fileWriterTestCase {
- return &fileWriterTestCase{files, fileName, rollingTypeTime, 0, 0, datePattern, writeCount, resFiles, nameMode}
+ return &fileWriterTestCase{files, fileName, rollingTypeTime, 0, 0, datePattern, writeCount, resFiles, nameMode, archiveType, archiveExploded, archivePath}
}
func TestRollingFileWriter(t *testing.T) {
@@ -64,9 +70,9 @@ func TestRollingFileWriter(t *testing.T) {
func rollingFileWriterGetter(testCase *fileWriterTestCase) (io.WriteCloser, error) {
if testCase.rollingType == rollingTypeSize {
- return NewRollingFileWriterSize(testCase.fileName, rollingArchiveNone, "", testCase.fileSize, testCase.maxRolls, testCase.nameMode)
+ return NewRollingFileWriterSize(testCase.fileName, testCase.archiveType, testCase.archivePath, testCase.fileSize, testCase.maxRolls, testCase.nameMode, testCase.archiveExploded)
} else if testCase.rollingType == rollingTypeTime {
- return NewRollingFileWriterTime(testCase.fileName, rollingArchiveNone, "", -1, testCase.datePattern, rollingIntervalDaily, testCase.nameMode)
+ return NewRollingFileWriterTime(testCase.fileName, testCase.archiveType, testCase.archivePath, -1, testCase.datePattern, rollingIntervalDaily, testCase.nameMode, testCase.archiveExploded)
}
return nil, fmt.Errorf("incorrect rollingType")
@@ -74,26 +80,27 @@ func rollingFileWriterGetter(testCase *fileWriterTestCase) (io.WriteCloser, erro
//===============================================================
var rollingfileWriterTests = []*fileWriterTestCase{
- createRollingSizeFileWriterTestCase([]string{}, "log.testlog", 10, 10, 1, []string{"log.testlog"}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{}, "log.testlog", 10, 10, 2, []string{"log.testlog", "log.testlog.1"}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{"1.log.testlog"}, "log.testlog", 10, 10, 2, []string{"log.testlog", "1.log.testlog", "2.log.testlog"}, rollingNameModePrefix),
- createRollingSizeFileWriterTestCase([]string{"log.testlog.1"}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.2"}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.1"}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{"log.testlog.9"}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.10"}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{"log.testlog.a", "log.testlog.1b"}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.1", "log.testlog.a", "log.testlog.1b"}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{}, `dir/log.testlog`, 10, 10, 1, []string{`dir/log.testlog`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{}, `dir/log.testlog`, 10, 10, 2, []string{`dir/log.testlog`, `dir/1.log.testlog`}, rollingNameModePrefix),
- createRollingSizeFileWriterTestCase([]string{`dir/dir/log.testlog.1`}, `dir/dir/log.testlog`, 10, 10, 2, []string{`dir/dir/log.testlog`, `dir/dir/log.testlog.1`, `dir/dir/log.testlog.2`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{`dir/dir/dir/log.testlog.1`}, `dir/dir/dir/log.testlog`, 10, 1, 2, []string{`dir/dir/dir/log.testlog`, `dir/dir/dir/log.testlog.2`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{}, `./log.testlog`, 10, 1, 2, []string{`log.testlog`, `log.testlog.1`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{`././././log.testlog.9`}, `log.testlog`, 10, 1, 2, []string{`log.testlog`, `log.testlog.10`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{"dir/dir/log.testlog.a", "dir/dir/log.testlog.1b"}, "dir/dir/log.testlog", 10, 1, 2, []string{"dir/dir/log.testlog", "dir/dir/log.testlog.1", "dir/dir/log.testlog.a", "dir/dir/log.testlog.1b"}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{}, `././dir/log.testlog`, 10, 10, 1, []string{`dir/log.testlog`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{}, `././dir/log.testlog`, 10, 10, 2, []string{`dir/log.testlog`, `dir/log.testlog.1`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{`././dir/dir/log.testlog.1`}, `dir/dir/log.testlog`, 10, 10, 2, []string{`dir/dir/log.testlog`, `dir/dir/log.testlog.1`, `dir/dir/log.testlog.2`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{`././dir/dir/dir/log.testlog.1`}, `dir/dir/dir/log.testlog`, 10, 1, 2, []string{`dir/dir/dir/log.testlog`, `dir/dir/dir/log.testlog.2`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{}, `././log.testlog`, 10, 1, 2, []string{`log.testlog`, `log.testlog.1`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{`././././log.testlog.9`}, `log.testlog`, 10, 1, 2, []string{`log.testlog`, `log.testlog.10`}, rollingNameModePostfix),
- createRollingSizeFileWriterTestCase([]string{"././dir/dir/log.testlog.a", "././dir/dir/log.testlog.1b"}, "dir/dir/log.testlog", 10, 1, 2, []string{"dir/dir/log.testlog", "dir/dir/log.testlog.1", "dir/dir/log.testlog.a", "dir/dir/log.testlog.1b"}, rollingNameModePostfix),
+ createRollingSizeFileWriterTestCase([]string{}, "log.testlog", 10, 10, 1, []string{"log.testlog"}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{}, "log.testlog", 10, 10, 2, []string{"log.testlog", "log.testlog.1"}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{"1.log.testlog"}, "log.testlog", 10, 10, 2, []string{"log.testlog", "1.log.testlog", "2.log.testlog"}, rollingNameModePrefix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{"log.testlog.1"}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.2"}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.1"}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{"log.testlog.9"}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.10"}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{"log.testlog.a", "log.testlog.1b"}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.1", "log.testlog.a", "log.testlog.1b"}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{}, `dir/log.testlog`, 10, 10, 1, []string{`dir/log.testlog`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{}, `dir/log.testlog`, 10, 10, 2, []string{`dir/log.testlog`, `dir/1.log.testlog`}, rollingNameModePrefix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{`dir/dir/log.testlog.1`}, `dir/dir/log.testlog`, 10, 10, 2, []string{`dir/dir/log.testlog`, `dir/dir/log.testlog.1`, `dir/dir/log.testlog.2`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{`dir/dir/dir/log.testlog.1`}, `dir/dir/dir/log.testlog`, 10, 1, 2, []string{`dir/dir/dir/log.testlog`, `dir/dir/dir/log.testlog.2`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{}, `./log.testlog`, 10, 1, 2, []string{`log.testlog`, `log.testlog.1`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{`././././log.testlog.9`}, `log.testlog`, 10, 1, 2, []string{`log.testlog`, `log.testlog.10`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{"dir/dir/log.testlog.a", "dir/dir/log.testlog.1b"}, "dir/dir/log.testlog", 10, 1, 2, []string{"dir/dir/log.testlog", "dir/dir/log.testlog.1", "dir/dir/log.testlog.a", "dir/dir/log.testlog.1b"}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{}, `././dir/log.testlog`, 10, 10, 1, []string{`dir/log.testlog`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{}, `././dir/log.testlog`, 10, 10, 2, []string{`dir/log.testlog`, `dir/log.testlog.1`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{`././dir/dir/log.testlog.1`}, `dir/dir/log.testlog`, 10, 10, 2, []string{`dir/dir/log.testlog`, `dir/dir/log.testlog.1`, `dir/dir/log.testlog.2`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{`././dir/dir/dir/log.testlog.1`}, `dir/dir/dir/log.testlog`, 10, 1, 2, []string{`dir/dir/dir/log.testlog`, `dir/dir/dir/log.testlog.2`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{}, `././log.testlog`, 10, 1, 2, []string{`log.testlog`, `log.testlog.1`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{`././././log.testlog.9`}, `log.testlog`, 10, 1, 2, []string{`log.testlog`, `log.testlog.10`}, rollingNameModePostfix, rollingArchiveNone, false, ""),
+ createRollingSizeFileWriterTestCase([]string{"././dir/dir/log.testlog.a", "././dir/dir/log.testlog.1b"}, "dir/dir/log.testlog", 10, 1, 2, []string{"dir/dir/log.testlog", "dir/dir/log.testlog.1", "dir/dir/log.testlog.a", "dir/dir/log.testlog.1b"}, rollingNameModePostfix, rollingArchiveNone, true, ""),
+ createRollingSizeFileWriterTestCase([]string{"log.testlog", "log.testlog.1"}, "log.testlog", 10, 1, 2, []string{"log.testlog", "log.testlog.2", "dir/log.testlog.1.zip"}, rollingNameModePostfix, rollingArchiveZip, true, "dir"),
// ====================
}