diff --git a/Analogy.LogViewer.Serilog.UnitTests/CompactJsonFormatTests.cs b/Analogy.LogViewer.Serilog.UnitTests/CompactJsonFormatTests.cs index 00af39c..df844a0 100644 --- a/Analogy.LogViewer.Serilog.UnitTests/CompactJsonFormatTests.cs +++ b/Analogy.LogViewer.Serilog.UnitTests/CompactJsonFormatTests.cs @@ -44,6 +44,21 @@ public void CompactJsonFormatTestAutomaticDetection(string fileName) var type = OfflineDataProvider.TryDetectFormat(file); Assert.IsTrue(type == FileFormat.CompactJsonFormatPerLine); } + [TestMethod] + + // [DataRow("rendered1.clef", 2, "test 2")] + [DataRow("rendered2.clef", 2, "test 2")] + public async Task OfflineProviderParserAlreadyRenderedTest(string fileName, int numberOfMessages, string text) + { + OfflineDataProvider parser = new OfflineDataProvider(); + UserSettingsManager.UserSettings.Settings.SupportFormats = new List { "*.Clef", "*.log", "*.gz", "*.zip" }; + CancellationTokenSource cts = new CancellationTokenSource(); + string file = Path.Combine(Folder, "log files", fileName); + MessageHandlerForTesting forTesting = new MessageHandlerForTesting(); + var messages = (await parser.Process(file, cts.Token, forTesting)).ToList(); + Assert.IsTrue(messages.Count == numberOfMessages); + Assert.IsTrue(messages[1].Text == text); + } [TestMethod] public async Task CompactJsonFormatParserTest() diff --git a/Analogy.LogViewer.Serilog/IAnalogy/OfflineDataProvider.cs b/Analogy.LogViewer.Serilog/IAnalogy/OfflineDataProvider.cs index 6a715d9..807ae11 100644 --- a/Analogy.LogViewer.Serilog/IAnalogy/OfflineDataProvider.cs +++ b/Analogy.LogViewer.Serilog/IAnalogy/OfflineDataProvider.cs @@ -167,7 +167,7 @@ private static FileFormat TryParsePerLine(string jsonData) } fields = new CompactJsonFormatMessageFields(); - if (jsonData.Contains(fields.Timestamp) && jsonData.Contains(fields.MessageTemplate)) + if (jsonData.Contains(fields.Timestamp) && (jsonData.Contains(fields.MessageTemplate) || jsonData.Contains(fields.Message))) { return FileFormat.CompactJsonFormatPerLine; }