Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Michael Barth and mgibas Added:
- Support to hide exception attachments to be configurable from AppSettings
Latest commit 0d3220b Nov 14, 2017

README.md

serilog-sinks-slack

Simple and beautifull Serilog Slack sink :)

NuGet

Install-Package Serilog.Sinks.Slack

Sample

Sample

Usages

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();
You can’t perform that action at this time.