C# Класс NLog.LogFactory

Creates and manages instances of T:NLog.Logger objects.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
CreateNullLogger ( ) : Logger

Creates a logger that discards all log messages.

DisableLogging ( ) : IDisposable

Decreases the log enable counter and if it reaches -1 the logs are disabled.

Logging is enabled if the number of EnableLogging calls is greater than or equal to DisableLogging calls.

Dispose ( ) : void

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

EnableLogging ( ) : void

Increases the log enable counter and if it reaches 0 the logs are disabled.

Logging is enabled if the number of EnableLogging calls is greater than or equal to DisableLogging calls.

Flush ( ) : void

Flush any pending log messages (in case of asynchronous targets).

Flush ( AsyncContinuation asyncContinuation ) : void

Flush any pending log messages (in case of asynchronous targets).

Flush ( AsyncContinuation asyncContinuation, System.TimeSpan timeout ) : void

Flush any pending log messages (in case of asynchronous targets).

Flush ( AsyncContinuation asyncContinuation, int timeoutMilliseconds ) : void

Flush any pending log messages (in case of asynchronous targets).

Flush ( System.TimeSpan timeout ) : void

Flush any pending log messages (in case of asynchronous targets).

Flush ( int timeoutMilliseconds ) : void

Flush any pending log messages (in case of asynchronous targets).

GetLogger ( string name ) : Logger

Gets the specified named logger.

GetLogger ( string name, Type loggerType ) : Logger

Gets the specified named logger.

IsLoggingEnabled ( ) : bool

Returns if logging is currently enabled.

Logging is enabled if the number of EnableLogging calls is greater than or equal to DisableLogging calls.

LogFactory ( ) : System

Initializes a new instance of the LogFactory class.

LogFactory ( LoggingConfiguration config ) : System

Initializes a new instance of the LogFactory class.

ReconfigExistingLoggers ( ) : void

Loops through all loggers previously returned by GetLogger and recalculates their target and filter list. Useful after modifying the configuration programmatically to ensure that all loggers have been properly configured.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Releases unmanaged and - optionally - managed resources.

Приватные методы

Метод Описание
ConfigFileChanged ( object sender, EventArgs args ) : void
Dump ( LoggingConfiguration config ) : void
GetCandidateFileNames ( ) : IEnumerable
GetConfigurationForLogger ( string name, LoggingConfiguration configuration ) : LoggerConfiguration
GetCurrentClassLogger ( ) : Logger
GetCurrentClassLogger ( Type loggerType ) : Logger
GetLogger ( LoggerCacheKey cacheKey ) : Logger
GetTargetsByLevelForLogger ( string name, IList rules, NLog.Internal.TargetWithFilterChain targetsByLevel, NLog.Internal.TargetWithFilterChain lastTargetsByLevel ) : void
ReconfigExistingLoggers ( LoggingConfiguration configuration ) : void
ReloadConfigOnTimer ( object state ) : void

Описание методов

CreateNullLogger() публичный Метод

Creates a logger that discards all log messages.
public CreateNullLogger ( ) : Logger
Результат Logger

DisableLogging() публичный Метод

Decreases the log enable counter and if it reaches -1 the logs are disabled.
Logging is enabled if the number of EnableLogging calls is greater than or equal to DisableLogging calls.
public DisableLogging ( ) : IDisposable
Результат IDisposable

Dispose() публичный Метод

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

Releases unmanaged and - optionally - managed resources.
protected Dispose ( bool disposing ) : void
disposing bool True to release both managed and unmanaged resources; false to release only unmanaged resources.
Результат void

EnableLogging() публичный Метод

Increases the log enable counter and if it reaches 0 the logs are disabled.
Logging is enabled if the number of EnableLogging calls is greater than or equal to DisableLogging calls.
public EnableLogging ( ) : void
Результат void

Flush() публичный Метод

Flush any pending log messages (in case of asynchronous targets).
public Flush ( ) : void
Результат void

Flush() публичный Метод

Flush any pending log messages (in case of asynchronous targets).
public Flush ( AsyncContinuation asyncContinuation ) : void
asyncContinuation AsyncContinuation The asynchronous continuation.
Результат void

Flush() публичный Метод

Flush any pending log messages (in case of asynchronous targets).
public Flush ( AsyncContinuation asyncContinuation, System.TimeSpan timeout ) : void
asyncContinuation AsyncContinuation The asynchronous continuation.
timeout System.TimeSpan Maximum time to allow for the flush. Any messages after that time will be discarded.
Результат void

Flush() публичный Метод

Flush any pending log messages (in case of asynchronous targets).
public Flush ( AsyncContinuation asyncContinuation, int timeoutMilliseconds ) : void
asyncContinuation AsyncContinuation The asynchronous continuation.
timeoutMilliseconds int Maximum time to allow for the flush. Any messages after that time will be discarded.
Результат void

Flush() публичный Метод

Flush any pending log messages (in case of asynchronous targets).
public Flush ( System.TimeSpan timeout ) : void
timeout System.TimeSpan Maximum time to allow for the flush. Any messages after that time will be discarded.
Результат void

Flush() публичный Метод

Flush any pending log messages (in case of asynchronous targets).
public Flush ( int timeoutMilliseconds ) : void
timeoutMilliseconds int Maximum time to allow for the flush. Any messages after that time will be discarded.
Результат void

GetLogger() публичный Метод

Gets the specified named logger.
public GetLogger ( string name ) : Logger
name string Name of the logger.
Результат Logger

GetLogger() публичный Метод

Gets the specified named logger.
public GetLogger ( string name, Type loggerType ) : Logger
name string Name of the logger.
loggerType System.Type The type of the logger to create. The type must inherit from NLog.Logger.
Результат Logger

IsLoggingEnabled() публичный Метод

Returns if logging is currently enabled.
Logging is enabled if the number of EnableLogging calls is greater than or equal to DisableLogging calls.
public IsLoggingEnabled ( ) : bool
Результат bool

LogFactory() публичный Метод

Initializes a new instance of the LogFactory class.
public LogFactory ( ) : System
Результат System

LogFactory() публичный Метод

Initializes a new instance of the LogFactory class.
public LogFactory ( LoggingConfiguration config ) : System
config NLog.Config.LoggingConfiguration The config.
Результат System

ReconfigExistingLoggers() публичный Метод

Loops through all loggers previously returned by GetLogger and recalculates their target and filter list. Useful after modifying the configuration programmatically to ensure that all loggers have been properly configured.
public ReconfigExistingLoggers ( ) : void
Результат void