Class BootstrapLoggerFactory
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
ILoggerProviderThe ILoggerProvider.
CreateConsole()
Creates a new BootstrapLoggerFactory that writes to the console.
public static BootstrapLoggerFactory CreateConsole()
Returns
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
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
CreateLogger(string)
Creates a new ILogger instance.
public ILogger CreateLogger(string categoryName)
Parameters
categoryName
stringThe category name for messages produced by the logger.
Returns
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
ILoggerFactoryThe logger factory from the service container.