Skip to content

Commit e7873c7

Browse files
author
Rafael Nicoletti@ubuntu
committed
fix merge conflict for PR 182
- serilog#182
2 parents 771be4f + de4bb4b commit e7873c7

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

src/Serilog.Sinks.File/RollingInterval.cs

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public enum RollingInterval
3434
/// </summary>
3535
Month,
3636

37+
/// <summary>
38+
/// Roll every calendar week. Filenames will have <code>yyyyMMdd</code> appended.
39+
/// </summary>
40+
Week,
41+
3742
/// <summary>
3843
/// Roll every day. Filenames will have <code>yyyyMMdd</code> appended.
3944
/// </summary>

src/Serilog.Sinks.File/Serilog.Sinks.File.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
1212
<PackageTags>serilog;file</PackageTags>
1313
<PackageIcon>images\icon.png</PackageIcon>
14-
<PackageIconUrl>https://serilog.net/images/serilog-sink-nuget.png</PackageIconUrl>
1514
<PackageProjectUrl>http://serilog.net</PackageProjectUrl>
1615
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
16+
<PackageLicense>http://www.apache.org/licenses/LICENSE-2.0</PackageLicense>
1717
<RepositoryUrl>https://github.com/serilog/serilog-sinks-file</RepositoryUrl>
1818
<RepositoryType>git</RepositoryType>
1919
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>

src/Serilog.Sinks.File/Sinks/File/RollingIntervalExtensions.cs

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public static string GetFormat(this RollingInterval interval)
2828
return "yyyy";
2929
case RollingInterval.Month:
3030
return "yyyyMM";
31+
case RollingInterval.Week:
32+
return "yyyyMMdd";
3133
case RollingInterval.Day:
3234
return "yyyyMMdd";
3335
case RollingInterval.Hour:
@@ -49,6 +51,8 @@ public static string GetFormat(this RollingInterval interval)
4951
return new DateTime(instant.Year, 1, 1, 0, 0, 0, instant.Kind);
5052
case RollingInterval.Month:
5153
return new DateTime(instant.Year, instant.Month, 1, 0, 0, 0, instant.Kind);
54+
case RollingInterval.Week:
55+
return new DateTime(instant.Year, instant.Month, instant.Day, 0, 0, 0, instant.Kind);
5256
case RollingInterval.Day:
5357
return new DateTime(instant.Year, instant.Month, instant.Day, 0, 0, 0, instant.Kind);
5458
case RollingInterval.Hour:
@@ -72,6 +76,8 @@ public static string GetFormat(this RollingInterval interval)
7276
return current.Value.AddYears(1);
7377
case RollingInterval.Month:
7478
return current.Value.AddMonths(1);
79+
case RollingInterval.Week:
80+
return current.Value.AddDays(7);
7581
case RollingInterval.Day:
7682
return current.Value.AddDays(1);
7783
case RollingInterval.Hour:

test/Serilog.Sinks.File.Tests/RollingIntervalExtensionsTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public class RollingIntervalExtensionsTests
1212
new object[]{ RollingInterval.Year, new DateTime(2018, 06, 01), new DateTime(2018, 01, 01), new DateTime(2019, 01, 01) },
1313
new object[]{ RollingInterval.Month, new DateTime(2018, 01, 01), new DateTime(2018, 01, 01), new DateTime(2018, 02, 01) },
1414
new object[]{ RollingInterval.Month, new DateTime(2018, 01, 14), new DateTime(2018, 01, 01), new DateTime(2018, 02, 01) },
15+
new object[]{ RollingInterval.Week, new DateTime(2018, 01, 01), new DateTime(2018, 01, 01), new DateTime(2018, 01, 08) },
16+
new object[]{ RollingInterval.Week, new DateTime(2018, 01, 01, 12, 0, 0), new DateTime(2018, 01, 01), new DateTime(2018, 01, 08) },
1517
new object[]{ RollingInterval.Day, new DateTime(2018, 01, 01), new DateTime(2018, 01, 01), new DateTime(2018, 01, 02) },
1618
new object[]{ RollingInterval.Day, new DateTime(2018, 01, 01, 12, 0, 0), new DateTime(2018, 01, 01), new DateTime(2018, 01, 02) },
1719
new object[]{ RollingInterval.Hour, new DateTime(2018, 01, 01, 0, 0, 0), new DateTime(2018, 01, 01), new DateTime(2018, 01, 01, 1, 0, 0) },

test/Serilog.Sinks.File.Tests/Serilog.Sinks.File.Tests.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
<ItemGroup>
2020
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
21+
<PackageReference Include="System.Runtime" Version="4.3.0" />
22+
<PackageReference Include="xunit.extensibility.core" Version="2.4.1" />
2123
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
2224
<PackageReference Include="xunit" Version="2.4.1" />
2325
</ItemGroup>

0 commit comments

Comments
 (0)