Table of Contents

Class BootstrapLoggerFactory

Namespace
Steeltoe.Common.Logging
Assembly
Steeltoe.Common.Logging.dll

Provides early logging at application initialization, before configuration has been loaded, the service container has been built, and the app has started. Once the app has started, the created loggers can be upgraded to utilize loaded configuration and the service container by calling UpgradeBootstrapLoggerFactory(IServiceCollection, BootstrapLoggerFactory).

public sealed class BootstrapLoggerFactory : ILoggerFactory, IDisposable
Inheritance
BootstrapLoggerFactory
Implements
Inherited Members

Methods

AddProvider(ILoggerProvider)

Adds an ILoggerProvider to the logging system.

public void AddProvider(ILoggerProvider provider)

Parameters

provider ILoggerProvider

The ILoggerProvider.

CreateConsole()

Creates a new BootstrapLoggerFactory that writes to the console.

public static BootstrapLoggerFactory CreateConsole()

Returns

BootstrapLoggerFactory

CreateConsole(Action<ILoggingBuilder>)

Creates a new BootstrapLoggerFactory that writes to the console.

public static BootstrapLoggerFactory CreateConsole(Action<ILoggingBuilder> configure)

Parameters

configure Action<ILoggingBuilder>

Enables to further configure the bootstrap logger from code.

Returns

BootstrapLoggerFactory

CreateEmpty(Action<ILoggingBuilder>)

Creates a new empty BootstrapLoggerFactory.

public static BootstrapLoggerFactory CreateEmpty(Action<ILoggingBuilder> configure)

Parameters

configure Action<ILoggingBuilder>

Enables to fully configure the bootstrap logger from code.

Returns

BootstrapLoggerFactory

CreateLogger(string)

Creates a new ILogger instance.

public ILogger CreateLogger(string categoryName)

Parameters

categoryName string

The category name for messages produced by the logger.

Returns

ILogger

The ILogger.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Upgrade(ILoggerFactory)

Upgrades the active loggers from new instances obtained from the service container.

public void Upgrade(ILoggerFactory loggerFactory)

Parameters

loggerFactory ILoggerFactory

The logger factory from the service container.