public void TestSequenceOn() { var naming = new FileNamingParameters() { IncludeLevel = false, IncludeLogger = false, IncludeSequence = true, IncludeSession = false, IncludeTimestamp = FileTimestampMode.None }; // ok... var info = GetLogEventInfo(); // check... var filename = naming.GetFilename(new LogWriteContext(), info); Assert.Equal(string.Format("Log - {0}.log", info.SequenceID), filename); }
public void TestEverythingOff() { var naming = new FileNamingParameters() { IncludeLevel = false, IncludeLogger = false, IncludeSequence = false, IncludeSession = false, IncludeTimestamp = FileTimestampMode.None }; // ok... var info = GetLogEventInfo(); // check... var filename = naming.GetFilename(new LogWriteContext(), info); Assert.Equal("Log.log", filename); }
public void TestTimestampBoth() { var naming = new FileNamingParameters() { IncludeLevel = false, IncludeLogger = false, IncludeSequence = false, IncludeSession = false, IncludeTimestamp = FileTimestampMode.DateTime }; // ok... var info = GetLogEventInfo(); // check... var filename = naming.GetFilename(new LogWriteContext(), info); Assert.Equal(string.Format("Log - {0}.log", LogManagerBase.GetDateTime().ToString("yyyyMMdd HHmmss")), filename); }
public void TestEverythingOn() { var naming = new FileNamingParameters() { IncludeLevel = true, IncludeLogger = true, IncludeSequence = true, IncludeSession = true, IncludeTimestamp = FileTimestampMode.DateTime }; // ok... var info = GetLogEventInfo(); // check... var context = new LogWriteContext(); var filename = naming.GetFilename(context, info); Assert.Equal($"Log - INFO - foobar - {LogManager.GetDateTime() .ToString("yyyyMMdd HHmmss")} - {context.Environment.SessionId} - {info.SequenceID}.log", filename); }
private async Task ZipFolderContents(StorageFolder sourceFolder, ZipArchive archive, string baseDirPath) { var files = await sourceFolder.GetFilesAsync(); var pattern = FileNamingParameters.GetRegex(); foreach (var file in files) { if (pattern.Match(file.Name).Success) { var readmeEntry = archive.CreateEntry(file.Name); var buffer = await ReadStorageFileToByteBuffer(file); var entryStream = readmeEntry.Open(); await entryStream.WriteAsync(buffer, 0, buffer.Length); await entryStream.FlushAsync(); entryStream.Dispose(); } } }
public void TestRegexEverythingOn() { var naming = new FileNamingParameters() { IncludeLevel = true, IncludeLogger = true, IncludeSequence = true, IncludeSession = true, IncludeTimestamp = FileTimestampMode.DateTime }; // get... var regex = naming.GetRegex(); // create... var info = GetLogEventInfo(); // check... var context = new LogWriteContext(); var filename = naming.GetFilename(context, info); // check... Assert.True(regex.Match(filename).Success); }