Storm.Serilog.Sinks.Discord
1.0.1
dotnet add package Storm.Serilog.Sinks.Discord --version 1.0.1
NuGet\Install-Package Storm.Serilog.Sinks.Discord -Version 1.0.1
<PackageReference Include="Storm.Serilog.Sinks.Discord" Version="1.0.1" />
<PackageVersion Include="Storm.Serilog.Sinks.Discord" Version="1.0.1" />
<PackageReference Include="Storm.Serilog.Sinks.Discord" />
paket add Storm.Serilog.Sinks.Discord --version 1.0.1
#r "nuget: Storm.Serilog.Sinks.Discord, 1.0.1"
#:package Storm.Serilog.Sinks.Discord@1.0.1
#addin nuget:?package=Storm.Serilog.Sinks.Discord&version=1.0.1
#tool nuget:?package=Storm.Serilog.Sinks.Discord&version=1.0.1
Storm.Serilog.Sink.Discord
A Utility Extension Library that provides sink for Serilog to Discord Webhook. Currently it's Webhook-based. In the future there might be some more functionalities. If you would like to see some improvements be done soon, please open an issue in this repository.
The package is now available on NuGet. You may install the main package using the following command
# Package Management Console
Install-Package Storm.Serilog.Sink.Discord
# .NET CLI
dotnet add package Storm.Serilog.Sink.Discord
Usage
// basics
using var messenger = new DiscordMessenger(YOUR_WEBHOOK_ID, "YOUR_WEBHOOK_TOKEN");
await messenger.SendMessageAsync(YOUR_DISCORD_MESSAGE);
// serilog
using Serilog;
using Storm.Serilog.Sink.Discord;
var logger = new LoggerConfiguration()
.WriteTo.DiscordWebhooks(YOUR_WEBHOOK_ID, "YOUR_WEBHOOK_TOKEN")
.CreateLogger();
logger.Information("custom information.");
// dependency injection
using Microsoft.Extensions.DependencyInjection;
using Storm.Serilog.Sink.Discord;
var services = new ServiceCollection()
.AddDiscordMessenger(YOUR_WEBHOOK_ID, "YOUR_WEBHOOK_TOKEN")
.BuildServiceProvider();
var messenger = services.GetRequiredService<DiscordMessenger>();
await messenger.SendMessageAsync(YOUR_DISCORD_MESSAGE);
Appendix: How to retrieve Webhook ID and Token
Follow the guidance of this article: Intro to Webhooks. On the same dialog where you create the Webhook, you should be able to see the Webhook URL like this
https://discordapp.com/api/webhooks/[YOUR_WEBHOOK_ID]/[YOUR_WEBHOOK_TOKEN]
Match your Webhook URL with the pattern above. Now you have all the information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Serilog (>= 2.10.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.