LoggerFactory Class

Definition

Produces instances of ILogger classes based on the given providers.

public ref class LoggerFactory : IDisposable, Microsoft::Extensions::Logging::ILoggerFactory
public class LoggerFactory : IDisposable, Microsoft.Extensions.Logging.ILoggerFactory
type LoggerFactory = class
    interface ILoggerFactory
    interface IDisposable
Public Class LoggerFactory
Implements IDisposable, ILoggerFactory
Inheritance
LoggerFactory
Implements

Constructors

LoggerFactory()

Creates a new LoggerFactory instance.

LoggerFactory(IEnumerable<ILoggerProvider>)

Creates a new LoggerFactory instance.

LoggerFactory(IEnumerable<ILoggerProvider>, IOptionsMonitor<LoggerFilterOptions>)

Creates a new LoggerFactory instance.

LoggerFactory(IEnumerable<ILoggerProvider>, LoggerFilterOptions)

Creates a new LoggerFactory instance.

Methods

AddProvider(ILoggerProvider)

Adds the given provider to those used in creating ILogger instances.

CheckDisposed()

Check if the factory has been disposed.

Create(Action<ILoggingBuilder>)

Creates new instance of ILoggerFactory configured using provided configure delegate.

CreateLogger(String)

Creates an ILogger with the given categoryName.

Dispose()
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Extension Methods

AddAzureWebAppDiagnostics(ILoggerFactory)

Adds an Azure Web Apps diagnostics logger.

AddAzureWebAppDiagnostics(ILoggerFactory, AzureAppServicesDiagnosticsSettings)

Adds an Azure Web Apps diagnostics logger.

AddConsole(ILoggerFactory)

Adds a console logger that is enabled for LogLevel.Information or higher.

AddConsole(ILoggerFactory, IConfiguration)
AddConsole(ILoggerFactory, IConsoleLoggerSettings)
AddConsole(ILoggerFactory, LogLevel)

Adds a console logger that is enabled for LogLevels of minLevel or higher.

AddConsole(ILoggerFactory, LogLevel, Boolean)

Adds a console logger that is enabled for LogLevels of minLevel or higher.

AddConsole(ILoggerFactory, Boolean)

Adds a console logger that is enabled for LogLevel.Information or higher.

AddConsole(ILoggerFactory, Func<String,LogLevel,Boolean>)

Adds a console logger that is enabled as defined by the filter function.

AddConsole(ILoggerFactory, Func<String,LogLevel,Boolean>, Boolean)

Adds a console logger that is enabled as defined by the filter function.

AddDebug(ILoggerFactory)

Adds a debug logger that is enabled for LogLevel.Information or higher.

AddDebug(ILoggerFactory, LogLevel)

Adds a debug logger that is enabled for LogLevels of minLevel or higher.

AddDebug(ILoggerFactory, Func<String,LogLevel,Boolean>)

Adds a debug logger that is enabled as defined by the filter function.

AddEventLog(ILoggerFactory)

Adds an event logger that is enabled for LogLevel.Information or higher.

AddEventLog(ILoggerFactory, EventLogSettings)

Adds an event logger. Use settings to enable logging for specific LogLevels.

AddEventLog(ILoggerFactory, LogLevel)

Adds an event logger that is enabled for LogLevels of minLevel or higher.

AddEventSourceLogger(ILoggerFactory)

Adds an event logger that is enabled for LogLevel.Information or higher.

WithFilter(ILoggerFactory, IFilterLoggerSettings)

Registers a wrapper logger which provides a common way to filter log messages across all registered ILoggerProviders.

CreateLogger(ILoggerFactory, Type)

Creates a new ILogger instance using the full name of the given type.

CreateLogger<T>(ILoggerFactory)

Creates a new ILogger instance using the full name of the given type.

AddTraceSource(ILoggerFactory, SourceSwitch)
AddTraceSource(ILoggerFactory, SourceSwitch, TraceListener)
AddTraceSource(ILoggerFactory, String)
AddTraceSource(ILoggerFactory, String, TraceListener)

Applies to