Skip to content

Commit bbb2737

Browse files
committed
Added restrictedToMinimumLevel overload to sink and ensure we call SetDefaultMinLogLevel
1 parent b313808 commit bbb2737

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Serilog.Sinks.Exceptionless/LoggerSinkConfigurationExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static LoggerConfiguration Exceptionless(
8282
if (loggerConfiguration == null)
8383
throw new ArgumentNullException(nameof(loggerConfiguration));
8484

85-
return loggerConfiguration.Sink(new ExceptionlessSink(additionalOperation, includeProperties, client), restrictedToMinimumLevel);
85+
return loggerConfiguration.Sink(new ExceptionlessSink(additionalOperation, includeProperties, client, restrictedToMinimumLevel), restrictedToMinimumLevel);
8686
}
8787
}
8888
}

src/Serilog.Sinks.Exceptionless/Sinks/Exceptionless/ExceptionlessSink.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using Exceptionless;
44
using Exceptionless.Dependency;
@@ -80,10 +80,14 @@ public ExceptionlessSink(
8080
/// <param name="client">
8181
/// Optional instance of <see cref="ExceptionlessClient"/> to use.
8282
/// </param>
83+
/// <param name="restrictedToMinimumLevel">
84+
/// The minimum log event level required in order to write an event to the sink.
85+
/// </param>
8386
public ExceptionlessSink(
8487
Func<EventBuilder, EventBuilder> additionalOperation = null,
8588
bool includeProperties = true,
86-
ExceptionlessClient client = null
89+
ExceptionlessClient client = null,
90+
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum
8791
) {
8892
_additionalOperation = additionalOperation;
8993
_includeProperties = includeProperties;
@@ -92,6 +96,8 @@ public ExceptionlessSink(
9296
if (_client.Configuration.Resolver.HasDefaultRegistration<IExceptionlessLog, NullExceptionlessLog>()) {
9397
_client.Configuration.UseLogger(new SelfLogLogger());
9498
}
99+
100+
_client.Configuration.SetDefaultMinLogLevel(restrictedToMinimumLevel.GetLevel());
95101
}
96102

97103
public void Emit(LogEvent logEvent) {

0 commit comments

Comments
 (0)