Beispiel #1
0
        static ILogWriter CreateBasicFileWriter()
        {
            var fileInfo = new SystemFileInfo("logs.txt");
            var checker  = new TimeArchiveNecessityChecker(fileInfo, 5, TimeUnit.SECONDS);
            var archiver = new FileArchiver(fileInfo, "Archive", checker);

            return(FileLogWriter.Builder()
                   .SetFileInfo(fileInfo)
                   .SetFileArchiver(archiver)
                   .Build());
        }
Beispiel #2
0
        static ILogWriter CreateErrorsFileWriter()
        {
            var errorsFileInfo    = new SystemFileInfo("errors.txt");
            var errorsChecker     = new SizeArchiveNecessityChecker(errorsFileInfo, 100, MemoryUnit.B);
            var fileNameFormatter = new MillisecondsArchiveFileNameFormatter("json");
            var errorsArchiver    = new FileArchiver(errorsFileInfo, "Archive_Errors", errorsChecker, fileNameFormatter: fileNameFormatter);
            var logLevels         = new LogLevel[] { LogLevel.ERROR, LogLevel.FATAL };

            return(FileLogWriter.Builder()
                   .SetFileInfo(errorsFileInfo)
                   .SetFileArchiver(errorsArchiver)
                   .SetAllowedLogLevels(logLevels)
                   .Build());
        }
 public void Before()
 {
     LogFileInfo         = new SystemFileInfo(TestLogFilePath);
     NonExistingFileInfo = new SystemFileInfo(NonExistingLogFilePath);
 }