项目作者: Narochno

项目描述 :
A batching Serilog sink for Slack.
高级语言: C#
项目地址: git://github.com/Narochno/Narochno.Serilog.Slack.git
创建时间: 2016-12-20T00:48:49Z
项目社区:https://github.com/Narochno/Narochno.Serilog.Slack

开源协议:MIT License

下载


Narochno.Serilog.Slack Build status NuGet

A batching Serilog sink for Slack, narochno. Each log message is sent as an attachment on the same message, with the log event properties rendered out as fields.

Screenshot

Example Usage

  1. var webHookUrl = "your webhook URL";
  2. var services = new ServiceCollection();
  3. services.AddSlack(new SlackConfig()
  4. {
  5. WebHookUrl = webHookUrl
  6. });
  7. var serviceProvider = services.BuildServiceProvider();
  8. var slackClient = serviceProvider.GetRequiredService<ISlackClient>();
  9. Log.Logger = new LoggerConfiguration()
  10. .MinimumLevel.Verbose()
  11. .WriteTo.SlackBlocking(slackClient, LogEventLevel.Information)
  12. .CreateLogger();
  13. Log.Information("Testing!");

More on correct usage of DI and Serilog on ASP.NET Core can be found here.
https://nblumhardt.com/2020/09/serilog-inject-dependencies/

See the Narochno.Slack project for more information.