Simple and beautifull Serilog Slack sink :)
Install-Package Serilog.Sinks.Slack
Minimal (using default WebHook integration settings)
Log.Logger = new LoggerConfiguration()
.WriteTo.Slack("https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
.CreateLogger();
Custom channel, username or icon:
Log.Logger = new LoggerConfiguration()
.WriteTo.Slack("https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 20, TimeSpan.FromSeconds(10), "#general" ,"Im a Ghost", ":ghost:")
.CreateLogger();
Advanced:
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.Slack(new SlackSinkOptions()
{
WebHookUrl = "https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
CustomChannel = "#test",
BatchSizeLimit = 20,
CustomIcon = ":ghost:",
Period = TimeSpan.FromSeconds(10),
ShowDefaultAttachments = false,
ShowExceptionAttachments = true,
})
.CreateLogger();