Skip to content

Savanta-Tech/serilog-sinks-slack

 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%