ILoggerFactory 接口

定义

表示一个类型,该类型用于配置日志记录系统并从已注册的 ILoggerProvider 创建 ILogger 的实例。Represents a type used to configure the logging system and create instances of ILogger from the registered ILoggerProviders.

public interface class ILoggerFactory : IDisposable
public interface ILoggerFactory : IDisposable
type ILoggerFactory = interface
    interface IDisposable
Public Interface ILoggerFactory
Implements IDisposable
派生
实现

方法

AddProvider(ILoggerProvider)

ILoggerProvider 添加到日志记录系统。Adds an ILoggerProvider to the logging system.

CreateLogger(String)

创建一个新的 ILogger 实例。Creates a new ILogger instance.

Dispose()

执行与释放或重置非托管资源关联的应用程序定义的任务。Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(继承自 IDisposable)

扩展方法

AddAzureWebAppDiagnostics(ILoggerFactory)
已过时。

添加 Azure Web 应用诊断记录器。Adds an Azure Web Apps diagnostics logger.

AddAzureWebAppDiagnostics(ILoggerFactory, AzureAppServicesDiagnosticsSettings)
已过时。

添加 Azure Web 应用诊断记录器。Adds an Azure Web Apps diagnostics logger.

AddConsole(ILoggerFactory)
已过时。

添加为 LogLevel.Information 或更高级别启用的控制台记录器。Adds a console logger that is enabled for LogLevel.Information or higher.

AddConsole(ILoggerFactory, IConfiguration)
AddConsole(ILoggerFactory, IConsoleLoggerSettings)
AddConsole(ILoggerFactory, LogLevel)
已过时。

添加为 minLevel 或更高级别的 LogLevel 启用的控制台记录器。Adds a console logger that is enabled for LogLevels of minLevel or higher.

AddConsole(ILoggerFactory, LogLevel, Boolean)
已过时。

添加为 minLevel 或更高级别的 LogLevel 启用的控制台记录器。Adds a console logger that is enabled for LogLevels of minLevel or higher.

AddConsole(ILoggerFactory, Boolean)
已过时。

添加为 LogLevel.Information 或更高级别启用的控制台记录器。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)
已过时。

添加为 LogLevel.Information 或更高级别启用的调试记录器。Adds a debug logger that is enabled for LogLevel.Information or higher.

AddDebug(ILoggerFactory, LogLevel)
已过时。

添加为 minLevel 或更高级别的 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)
已过时。

添加为 LogLevel.Information 或更高级别启用的事件记录器。Adds an event logger that is enabled for LogLevel.Information or higher.

AddEventLog(ILoggerFactory, EventLogSettings)
已过时。

添加事件记录器。Adds an event logger. 使用 settings 为特定 LogLevel 启用日志记录。Use settings to enable logging for specific LogLevels.

AddEventLog(ILoggerFactory, LogLevel)
已过时。

添加为 minLevel 或更高级别的 LogLevel 启用的事件记录器。Adds an event logger that is enabled for LogLevels of minLevel or higher.

AddEventSourceLogger(ILoggerFactory)
已过时。

添加为 LogLevel.Information 或更高级别启用的事件记录器。Adds an event logger that is enabled for LogLevel.Information or higher.

WithFilter(ILoggerFactory, IFilterLoggerSettings)

注册一种包装器记录器,该记录器提供了一种在所有已注册的 ILoggerProvider 中筛选日志消息的常见方法。Registers a wrapper logger which provides a common way to filter log messages across all registered ILoggerProviders.

CreateLogger(ILoggerFactory, Type)

使用给定 type 的全名创建一个新的 ILogger 实例。Creates a new ILogger instance using the full name of the given type.

CreateLogger<T>(ILoggerFactory)

使用给定类型的全名创建一个新的 ILogger 实例。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)

适用于