14
14
15
15
using System ;
16
16
using Serilog . Configuration ;
17
+ using Serilog . Core ;
18
+ using Serilog . Events ;
17
19
using Serilog . Extensions . Logging ;
18
20
19
21
namespace Serilog
@@ -28,12 +30,20 @@ public static class LoggerSinkConfigurationExtensions
28
30
/// </summary>
29
31
/// <param name="configuration">The `WriteTo` object.</param>
30
32
/// <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>
31
37
/// <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 )
33
43
{
34
44
if ( configuration == null ) throw new ArgumentNullException ( nameof ( configuration ) ) ;
35
45
if ( providers == null ) throw new ArgumentNullException ( nameof ( providers ) ) ;
36
- return configuration . Sink ( new LoggerProviderCollectionSink ( providers ) ) ;
46
+ return configuration . Sink ( new LoggerProviderCollectionSink ( providers ) , restrictedToMinimumLevel , levelSwitch ) ;
37
47
}
38
48
}
39
49
}
0 commit comments