Class BootstrapLogger
Provides non-generic convenience APIs for creating a pre-host logger using an explicit category name.
Inherited Members
Namespace: Eigenverft.NetLib.Infrastructure.Hosting.Logging.BootstrapLogger
Assembly: Eigenverft.NetLib.Infrastructure.dll
Syntax
public static class BootstrapLogger
Remarks
This is a convenience facade over the same cached factory used by BootstrapLogger<TCategoryName>.
Methods
| Edit this page View SourceCreateLogger(string, IConfiguration?)
Creates a pre-host ILogger for the given category name.
Declaration
public static ILogger CreateLogger(string categoryName, IConfiguration? configuration = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | categoryName | The logger category name. |
| IConfiguration | configuration | Optional configuration used only when the process-wide factory is first created. It may apply the "Logging" section to the Microsoft fallback factory when the required logging configuration package is available. |
Returns
| Type | Description |
|---|---|
| ILogger | A logger instance that can be used prior to building the host. |
Examples
ILogger startupLogger = BootstrapLogger.CreateLogger("Startup", builder.Configuration);
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
CreateLoggerFactory(IConfiguration?)
Creates (or returns the cached) ILoggerFactory suitable for pre-host usage.
Declaration
public static ILoggerFactory CreateLoggerFactory(IConfiguration? configuration = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IConfiguration | configuration | Optional configuration used to apply the "Logging" section (levels and filters) if available. |
Returns
| Type | Description |
|---|---|
| ILoggerFactory | The process-owned cached ILoggerFactory. Callers may create loggers from it but must not dispose it. |
CreateRequiredSerilogLogger(string, string, string?, string, bool)
Creates a required Serilog-backed pre-host logger for an explicit category from one JSON file.
Declaration
public static ILogger CreateRequiredSerilogLogger(string categoryName, string configurationFile = "AppSettings/BootstrapLoggerSettings.json", string? baseDirectory = null, string sectionName = "Serilog", bool reloadOnChange = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | categoryName | The logger category name. |
| string | configurationFile | The isolated bootstrap Serilog JSON file. |
| string | baseDirectory | The optional base directory; null uses BaseDirectory. |
| string | sectionName | The Serilog configuration section name. |
| bool | reloadOnChange | Whether existing Serilog level overrides and switches may follow JSON changes. Sink topology is not rebuilt. |
Returns
| Type | Description |
|---|---|
| ILogger | A stable Serilog-backed ILogger. |
Remarks
This is the non-generic facade for CreateRequiredSerilogLogger(string, string?, string, bool) and has the same strict first-call, no-fallback, isolated-configuration, reflection-only, and static-initialization semantics.