Table of Contents

Class SerilogHostBuilderExtensions

Namespace
Steeltoe.Extensions.Logging.DynamicSerilog
Assembly
Steeltoe.Extensions.Logging.DynamicSerilogBase.dll
public static class SerilogHostBuilderExtensions
Inheritance
SerilogHostBuilderExtensions
Inherited Members

Methods

AddDynamicSerilog(IHostBuilder, Action<HostBuilderContext, LoggerConfiguration>, bool, bool)

Configure Serilog as the IDynamicLoggerProvider to enable dynamically controlling log levels via management endpoints

public static IHostBuilder AddDynamicSerilog(this IHostBuilder hostBuilder, Action<HostBuilderContext, LoggerConfiguration> configureLogger = null, bool preserveStaticLogger = false, bool preserveDefaultConsole = false)

Parameters

hostBuilder IHostBuilder

The IHostBuilder to configure

configureLogger Action<HostBuilderContext, LoggerConfiguration>

The delegate for configuring the DynamicLoggerConfiguration that will be used to construct a Logger

preserveStaticLogger bool

Indicates whether to preserve the value of Logger.

preserveDefaultConsole bool

When true, do not remove Microsoft's ConsoleLoggerProvider

Returns

IHostBuilder

The IHostBuilder

UseSerilogDynamicConsole(IHostBuilder, Action<HostBuilderContext, LoggerConfiguration>, bool)

Sets Steeltoe IDynamicLoggerProvider Serilog implementation as a LoggerProvider which supports dynamically controlling the minimum log level via management endpoints

[Obsolete("Please use 'AddDynamicSerilog' instead")]
public static IHostBuilder UseSerilogDynamicConsole(this IHostBuilder hostBuilder, Action<HostBuilderContext, LoggerConfiguration> configureLogger = null, bool preserveStaticLogger = false)

Parameters

hostBuilder IHostBuilder

The IHostBuilder to configure

configureLogger Action<HostBuilderContext, LoggerConfiguration>

The delegate for configuring the DynamicLoggerConfiguration that will be used to construct a Logger

preserveStaticLogger bool

Indicates whether to preserve the value of Logger.

Returns

IHostBuilder

The IHostBuilder