C# Class NLog.LogFactory

Creates and manages instances of T:NLog.Logger objects.
Inheritance: IDisposable
Afficher le fichier Open project: shiftkey/winrt-backport-hilarity Class Usage Examples

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Releases unmanaged and - optionally - managed resources.

Private Methods

Méthode Description
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

Method Details

CreateNullLogger() public méthode

Creates a logger that discards all log messages.
public CreateNullLogger ( ) : Logger
Résultat Logger

DisableLogging() public méthode

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
Résultat IDisposable

Dispose() public méthode

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

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.
Résultat void

EnableLogging() public méthode

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
Résultat void

Flush() public méthode

Flush any pending log messages (in case of asynchronous targets).
public Flush ( ) : void
Résultat void

Flush() public méthode

Flush any pending log messages (in case of asynchronous targets).
public Flush ( AsyncContinuation asyncContinuation ) : void
asyncContinuation AsyncContinuation The asynchronous continuation.
Résultat void

Flush() public méthode

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.
Résultat void

Flush() public méthode

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.
Résultat void

Flush() public méthode

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.
Résultat void

Flush() public méthode

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.
Résultat void

GetLogger() public méthode

Gets the specified named logger.
public GetLogger ( string name ) : Logger
name string Name of the logger.
Résultat Logger

GetLogger() public méthode

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.
Résultat Logger

IsLoggingEnabled() public méthode

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
Résultat bool

LogFactory() public méthode

Initializes a new instance of the LogFactory class.
public LogFactory ( ) : System
Résultat System

LogFactory() public méthode

Initializes a new instance of the LogFactory class.
public LogFactory ( LoggingConfiguration config ) : System
config NLog.Config.LoggingConfiguration The config.
Résultat System

ReconfigExistingLoggers() public méthode

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
Résultat void