Skip to content

Class SerilogHostApplicationBuilderExtensions

Namespace: Cephalon.Observability.Serilog.Hosting
Assembly: Cephalon.Observability.Serilog.dll

Adds Serilog provider wiring for Cephalon hosts without changing the shared contract.

public static class SerilogHostApplicationBuilderExtensions

objectSerilogHostApplicationBuilderExtensions

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

AddCephalonSerilog<TBuilder>(TBuilder, Action<IServiceProvider, LoggerConfiguration>?)

Section titled “ AddCephalonSerilog<TBuilder>(TBuilder, Action<IServiceProvider, LoggerConfiguration>?)”

Adds Serilog as an provider for the target host builder.

public static TBuilder AddCephalonSerilog<TBuilder>(this TBuilder builder, Action<IServiceProvider, LoggerConfiguration>? configure = null) where TBuilder : IHostApplicationBuilder

builder TBuilder

The target host-application builder.

configure Action<IServiceProvider, LoggerConfiguration>?

An optional callback that can extend or override the configuration-driven Serilog pipeline.

TBuilder

The same builder instance for fluent host composition.

TBuilder

The host-application builder type to extend.

This package keeps provider-specific logging integration outside Cephalon.Engine and Cephalon.Observability. Hosts opt in explicitly when they want Serilog sinks, enrichers, or formatting while still logging through injected ILogger<T> services.

The standard top-level Serilog configuration section is read automatically when present. If no Serilog section exists and no code-based configuration callback is supplied, registration is skipped so hosts do not accidentally replace their existing logging setup with an empty pipeline.