Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose MinimumLogEventLevel to configuration extensions #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Serilog.Sinks.Slack/SlackLoggerConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static class SlackLoggerConfigurationExtensions
/// <param name="propertyDenyList">If specified, only properties that are not in this list are logged.</param>
/// <param name="timestampFormat">The <see href="https://docs.microsoft.com/dotnet/standard/base-types/standard-date-and-time-format-strings"> date and time format</see> for timestamps in messages.</param>
/// <param name="queueLimit">The maximum number of events to hold in the sink's internal queue, or <c>null</c> for an unbounded queue. The default is <c>100000</c>.</param>
/// <param name="minimumLogEventLevel">The minimum Log Level to log for this sink</param>
/// <returns>Instance of <see cref="LoggerConfiguration"/> object.</returns>
public static LoggerConfiguration Slack(
this LoggerSinkConfiguration loggerSinkConfiguration,
Expand All @@ -63,7 +64,8 @@ public static LoggerConfiguration Slack(
List<string> propertyAllowList = null,
List<string> propertyDenyList = null,
string timestampFormat = null,
int? queueLimit = 100000)
int? queueLimit = 100000,
LogEventLevel minimumLogEventLevel = LogEventLevel.Verbose)
{

var formatter = new MessageTemplateTextFormatter(outputTemplate, formatProvider);
Expand All @@ -84,7 +86,8 @@ public static LoggerConfiguration Slack(
propertyAllowList,
propertyDenyList,
timestampFormat,
queueLimit);
queueLimit,
minimumLogEventLevel);
}

/// <summary>
Expand Down Expand Up @@ -117,6 +120,7 @@ public static LoggerConfiguration Slack(
/// <param name="propertyDenyList">If specified, only properties that are not in this list are logged.</param>
/// <param name="timestampFormat">The <see href="https://docs.microsoft.com/dotnet/standard/base-types/standard-date-and-time-format-strings"> date and time format</see> for timestamps in messages.</param>
/// <param name="queueLimit">The maximum number of events to hold in the sink's internal queue, or <c>null</c> for an unbounded queue. The default is <c>100000</c>.</param>
/// <param name="minimumLogEventLevel">The minimum Log Level to log for this sink</param>
/// <returns>Instance of <see cref="LoggerConfiguration"/> object.</returns>
public static LoggerConfiguration Slack(
this LoggerSinkConfiguration loggerSinkConfiguration,
Expand All @@ -136,7 +140,8 @@ public static LoggerConfiguration Slack(
List<string> propertyAllowList = null,
List<string> propertyDenyList = null,
string timestampFormat = null,
int? queueLimit = 100000)
int? queueLimit = 100000,
LogEventLevel minimumLogEventLevel = LogEventLevel.Verbose)
{
var slackSinkOptions = new SlackSinkOptions
{
Expand All @@ -152,7 +157,8 @@ public static LoggerConfiguration Slack(
PropertyDenyList = propertyDenyList,
ShowExceptionAttachments = showExceptionAttachments,
TimestampFormat = timestampFormat,
QueueLimit = queueLimit
QueueLimit = queueLimit,
MinimumLogEventLevel = minimumLogEventLevel
};

if (batchSizeLimit.HasValue)
Expand Down