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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Storm.Serilog.Sinks.Discord" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Storm.Serilog.Sinks.Discord" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Storm.Serilog.Sinks.Discord" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Storm.Serilog.Sinks.Discord --version 1.0.1
                    
#r "nuget: Storm.Serilog.Sinks.Discord, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Storm.Serilog.Sinks.Discord@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Storm.Serilog.Sinks.Discord&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Storm.Serilog.Sinks.Discord&version=1.0.1
                    
Install as a Cake Tool

Storm.Serilog.Sink.Discord | NuGet version (Storm.Serilog.Sink.Discord)

Storm.Logo

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 361 1/5/2022
1.0.0 304 1/5/2022