/serilog-sinks-slack

Primary LanguageC#OtherNOASSERTION

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();