Пример #1
0
        public void TestSetup()
        {
            timeSuffixFormatter = Substitute.For <IFileSuffixFormatter <DateTime> >();
            sizeSuffixFormatter = Substitute.For <IFileSuffixFormatter <int> >();

            suffixFormatter = new HybridSuffixFormatter(timeSuffixFormatter, sizeSuffixFormatter);
        }
Пример #2
0
        private static IRollingStrategy CreateHybridStrategy(Func <FileLogSettings> settingsProvider, IFileSystem fileSystem)
        {
            var sizeSuffixFormatter   = new SizeBasedSuffixFormatter();
            var timeSuffixFormatter   = new TimeBasedSuffixFormatter(() => settingsProvider().RollingStrategy.Period);
            var hybridSuffixFormatter = new HybridSuffixFormatter(timeSuffixFormatter, sizeSuffixFormatter, () => settingsProvider().RollingStrategy.SuffixSeparator);
            var sizeStrategy          = CreateSizeBasedStrategy(settingsProvider, fileSystem, sizeSuffixFormatter);

            return(new HybridRollingStrategy(fileSystem, sizeStrategy, () => DateTime.Now, timeSuffixFormatter, hybridSuffixFormatter, () => settingsProvider().RollingStrategy.SuffixSeparator));
        }