Skip to content

Commit d2155ce

Browse files
committed
Add usual level control params to WriteTo.Providers()
1 parent c950770 commit d2155ce

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Serilog.Extensions.Logging/LoggerSinkConfigurationExtensions.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
using System;
1616
using Serilog.Configuration;
17+
using Serilog.Core;
18+
using Serilog.Events;
1719
using Serilog.Extensions.Logging;
1820

1921
namespace Serilog
@@ -28,12 +30,20 @@ public static class LoggerSinkConfigurationExtensions
2830
/// </summary>
2931
/// <param name="configuration">The `WriteTo` object.</param>
3032
/// <param name="providers">A <see cref="LoggerProviderCollection"/> to write events to.</param>
33+
/// <param name="restrictedToMinimumLevel">The minimum level for
34+
/// events passed through the sink. Ignored when <paramref name="levelSwitch"/> is specified.</param>
35+
/// <param name="levelSwitch">A switch allowing the pass-through minimum level
36+
/// to be changed at runtime.</param>
3137
/// <returns>A <see cref="LoggerConfiguration"/> to allow method chaining.</returns>
32-
public static LoggerConfiguration Providers(this LoggerSinkConfiguration configuration, LoggerProviderCollection providers)
38+
public static LoggerConfiguration Providers(
39+
this LoggerSinkConfiguration configuration,
40+
LoggerProviderCollection providers,
41+
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
42+
LoggingLevelSwitch levelSwitch = null)
3343
{
3444
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
3545
if (providers == null) throw new ArgumentNullException(nameof(providers));
36-
return configuration.Sink(new LoggerProviderCollectionSink(providers));
46+
return configuration.Sink(new LoggerProviderCollectionSink(providers), restrictedToMinimumLevel, levelSwitch);
3747
}
3848
}
3949
}

0 commit comments

Comments
 (0)