Table of Contents

Class SerilogWebHostBuilderExtensions

Namespace
Steeltoe.Extensions.Logging.DynamicSerilog
Assembly
Steeltoe.Extensions.Logging.DynamicSerilogCore.dll
public static class SerilogWebHostBuilderExtensions
Inheritance
SerilogWebHostBuilderExtensions
Inherited Members

Methods

AddDynamicSerilog(IWebHostBuilder, Action<WebHostBuilderContext, LoggerConfiguration>, bool)

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

public static IWebHostBuilder AddDynamicSerilog(this IWebHostBuilder hostBuilder, Action<WebHostBuilderContext, LoggerConfiguration> configureLogger = null, bool preserveDefaultConsole = false)

Parameters

hostBuilder IWebHostBuilder

The IWebHostBuilder to configure

configureLogger Action<WebHostBuilderContext, LoggerConfiguration>

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

preserveDefaultConsole bool

When true, do not remove Microsoft's ConsoleLoggerProvider

Returns

IWebHostBuilder

The IWebHostBuilder

AddDynamicSerilog(IWebHostBuilder, Action<WebHostBuilderContext, LoggerConfiguration>, bool, bool)

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

[Obsolete("Use a different overload of AddDynamicSerilog")]
public static IWebHostBuilder AddDynamicSerilog(this IWebHostBuilder hostBuilder, Action<WebHostBuilderContext, LoggerConfiguration> configureLogger, bool preserveStaticLogger, bool preserveDefaultConsole = false)

Parameters

hostBuilder IWebHostBuilder

The IWebHostBuilder to configure

configureLogger Action<WebHostBuilderContext, LoggerConfiguration>

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

preserveStaticLogger bool

Not Supported!

preserveDefaultConsole bool

When true, do not remove Microsoft's ConsoleLoggerProvider

Returns

IWebHostBuilder

The IWebHostBuilder

UseSerilogDynamicConsole(IWebHostBuilder, Action<WebHostBuilderContext, 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 IWebHostBuilder UseSerilogDynamicConsole(this IWebHostBuilder hostBuilder, Action<WebHostBuilderContext, LoggerConfiguration> configureLogger = null, bool preserveStaticLogger = false)

Parameters

hostBuilder IWebHostBuilder

The IWebHostBuilder to configure

configureLogger Action<WebHostBuilderContext, 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

IWebHostBuilder

The IWebHostBuilder