public static LoggerConfiguration Slack( this LoggerSinkConfiguration loggerSinkConfiguration, string token, SlackLogOptions options, LogEventLevel minimumLevel = LevelAlias.Minimum) { if (loggerSinkConfiguration == null) { throw new ArgumentNullException(nameof(loggerSinkConfiguration)); } if (token == null) { throw new ArgumentNullException(nameof(token)); } if (options?.Channel == null) { throw new ArgumentNullException(nameof(options.Channel)); } ILogEventSink sink = new SlackSink(options, token); return(loggerSinkConfiguration.Sink(sink, minimumLevel)); }
public static LoggerConfiguration Slack( this LoggerSinkConfiguration loggerSinkConfiguration, string webhookUrl, string customChannel = null, string customUsername = null, string customIcon = null, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum) { if (loggerSinkConfiguration == null) { throw new ArgumentNullException(nameof(loggerSinkConfiguration)); } if (string.IsNullOrWhiteSpace(webhookUrl)) { throw new ArgumentNullException(nameof(webhookUrl)); } ILogEventSink sink = new SlackSink(webhookUrl, customChannel, customUsername, customIcon); return(loggerSinkConfiguration.Sink(sink, restrictedToMinimumLevel)); }
public static LoggerConfiguration Slack( this LoggerSinkConfiguration sinkConfiguration, string webHookUrl, string channel, string userName, string iconUrl = null, string iconEmoji = null, string outputTemplate = DefaultOutputTemplate, IFormatProvider formatProvider = null, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum) { if (sinkConfiguration == null) { throw new ArgumentNullException("sinkConfiguration"); } var formatter = new MessageTemplateTextFormatter(outputTemplate, formatProvider); var sink = new SlackSink(webHookUrl, channel, userName, iconUrl, iconEmoji, formatter); return(sinkConfiguration.Sink(sink, restrictedToMinimumLevel)); }