Skip to content

SerilogPlugin

NexusLabs.Needlr.Serilog

NexusLabs.Needlr.Serilog

SerilogPlugin Class

Auto-discovered plugin that wires Serilog as the logging provider using configuration from appsettings.json (or any Microsoft.Extensions.Configuration.IConfiguration source registered with Needlr).

public sealed class SerilogPlugin : NexusLabs.Needlr.IServiceCollectionPlugin

Inheritance System.Object 🡒 SerilogPlugin

Implements NexusLabs.Needlr.IServiceCollectionPlugin

Remarks

This plugin provides a zero-ceremony default: reference the NexusLabs.Needlr.Serilog package and add a "Serilog" section to appsettings.json. The plugin is auto-discovered and configures Microsoft.Extensions.Logging.ILogger<> resolution via DI.

The Serilog logger is owned by the DI container — sinks flush automatically on container disposal. The static Serilog.Log.Logger is not set — use Microsoft.Extensions.Logging.ILogger<> injection instead, or use NeedlrSerilogBootstrapper for apps that need the static logger and two-stage bootstrap lifecycle.