Serilog.Sinks.AspNetCore.App.SignalR
1.0.0
See the version list below for details.
dotnet add package Serilog.Sinks.AspNetCore.App.SignalR --version 1.0.0
NuGet\Install-Package Serilog.Sinks.AspNetCore.App.SignalR -Version 1.0.0
<PackageReference Include="Serilog.Sinks.AspNetCore.App.SignalR" Version="1.0.0" />
paket add Serilog.Sinks.AspNetCore.App.SignalR --version 1.0.0
#r "nuget: Serilog.Sinks.AspNetCore.App.SignalR, 1.0.0"
// Install Serilog.Sinks.AspNetCore.App.SignalR as a Cake Addin #addin nuget:?package=Serilog.Sinks.AspNetCore.App.SignalR&version=1.0.0 // Install Serilog.Sinks.AspNetCore.App.SignalR as a Cake Tool #tool nuget:?package=Serilog.Sinks.AspNetCore.App.SignalR&version=1.0.0
Usage
Call the IServiceCollection
extension method AddSerilogHub
to register a SignalR Hub
with the Serilog sink. This step is necessary in order to prevent circular dependencies caused during logger initialization.
builder.Services.AddSerilogHub<SampleHub>();
Call AddSerilog
and configure the Hub
in which events should be logged to. Make sure to pass the IServiceProvider
down to the SignalR sink. The delegate provides the IHubContext
for the Hub
specified in the generic type parameter of the SignalR sink and the formatted Serilog event message.
builder.Services.AddSerilog(
(serviceProvider, loggerConfiguration) =>
loggerConfiguration.WriteTo.SignalR<SampleHub>(
serviceProvider,
(context, message) =>
context.Clients.All.SendAsync("Receive", message)
));
Lastly, make sure to register the Hub
.
app.MapHub<SampleHub>("/sample");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Serilog (>= 3.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Serilog.Sinks.AspNetCore.App.SignalR:
Repository | Stars |
---|---|
LANCommander/LANCommander
|