Skip to content

Commit

Permalink
Merge pull request #166 from datalust/dev
Browse files Browse the repository at this point in the history
5.1.1 Release
  • Loading branch information
nblumhardt authored Jan 13, 2022
2 parents 5d03588 + 8a37c72 commit 9050b7c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Serilog.Sinks.Seq/Serilog.Sinks.Seq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<PropertyGroup>
<Description>Serilog sink that writes to the Seq log server over HTTP/HTTPS.</Description>
<VersionPrefix>5.1.0</VersionPrefix>
<VersionPrefix>5.1.1</VersionPrefix>
<Authors>Serilog Contributors</Authors>
<Copyright>Copyright © Serilog Contributors</Copyright>
<TargetFrameworks>netstandard1.1;netstandard1.3;netstandard2.0;net4.5;netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFrameworks>net5.0;netstandard1.1;netstandard1.3;netstandard2.0;net4.5;netcoreapp3.1</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>Serilog</RootNamespace>
Expand Down
3 changes: 2 additions & 1 deletion src/Serilog.Sinks.Seq/Sinks/Seq/Durable/FileSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public FileSet(string bufferBaseFilename)
// The extension cannot be matched here because it may be either "json" (raw format) or "clef" (compact).
_candidateSearchPath = Path.GetFileName(bufferBaseFilename) + "-*.*";

_filenameMatcher = new Regex("^" + Regex.Escape(Path.GetFileName(bufferBaseFilename)) + "-(?<date>\\d{8})(?<sequence>_[0-9]{3,}){0,1}\\.(json|clef)$");
_filenameMatcher = new Regex("^" + Regex.Escape(Path.GetFileName(bufferBaseFilename)) + "-(?<date>\\d{8})(?<sequence>_[0-9]{3,}){0,1}\\.(?<ext>json|clef)$");
}

public BookmarkFile OpenBookmarkFile()
Expand All @@ -61,6 +61,7 @@ public string[] GetBufferFiles()
.Select(n => new KeyValuePair<string, Match>(n, _filenameMatcher.Match(Path.GetFileName(n))))
.Where(nm => nm.Value.Success)
.OrderBy(nm => nm.Value.Groups["date"].Value, StringComparer.OrdinalIgnoreCase)
.ThenByDescending(nm => nm.Value.Groups["ext"].Value)
.ThenBy(nm => int.Parse("0" + nm.Value.Groups["sequence"].Value.Replace("_", "")))
.Select(nm => nm.Key)
.ToArray();
Expand Down
15 changes: 13 additions & 2 deletions test/Serilog.Sinks.Seq.Tests/Durable/FileSetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ public void MatchingBufferFilenamesAreFoundAndOrdered()
const string? fakeContent = "{}";

// Matching
var shouldMatch = new[] {bbf + "-20180101.json", bbf + "-20180102.json", bbf + "-20180102_001.json"};
var shouldMatch = new[]
{
bbf + "-20180101.json",
bbf + "-20180102.json",
bbf + "-20180102_001.json",
bbf + "-20180103.json",
bbf + "-20180103.clef",
bbf + "-20180104.clef",
bbf + "-20180104_001.clef",
bbf + "-20180104_002.clef",
bbf + "-20180105.clef"
};
foreach (var fn in shouldMatch)
System.IO.File.WriteAllText(fn, fakeContent);

Expand All @@ -31,7 +42,7 @@ public void MatchingBufferFilenamesAreFoundAndOrdered()
var fileSet = new FileSet(bbf);
var files = fileSet.GetBufferFiles();

Assert.Equal(3, files.Length);
Assert.Equal(9, files.Length);
Assert.Equal(shouldMatch, files);
}
}
Expand Down

0 comments on commit 9050b7c

Please sign in to comment.