C# Class NLog.LogManager

Creates and manages instances of T:NLog.Logger objects.
Afficher le fichier Open project: NLog/NLog Class Usage Examples

Private Properties

Свойство Type Description
AddHiddenAssembly void
CreateNullLogger Logger
GetClassFullName string
GetCurrentClassLogger Logger
GetCurrentClassLogger Logger
GetLogger Logger
GetLogger Logger
IsHiddenAssembly bool
LogManager System
LogManager_OnStopLogging void
SetupTerminationEvents void

Méthodes publiques

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

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) with the default timeout of 15 seconds.

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).

IsLoggingEnabled ( ) : bool

Checks if logging is currently enabled.

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

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.

Shutdown ( ) : void

Dispose all targets, and shutdown logging.

Private Methods

Méthode Description
AddHiddenAssembly ( Assembly assembly ) : void
CreateNullLogger ( ) : Logger
GetClassFullName ( ) : string

Gets the fully qualified name of the class invoking the LogManager, including the namespace but not the assembly.

GetCurrentClassLogger ( ) : Logger
GetCurrentClassLogger ( Type loggerType ) : Logger
GetLogger ( string name ) : Logger
GetLogger ( string name, Type loggerType ) : Logger
IsHiddenAssembly ( Assembly assembly ) : bool
LogManager ( ) : System
LogManager_OnStopLogging ( object sender, EventArgs args ) : void
SetupTerminationEvents ( ) : void

Method Details

DisableLogging() public static 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 static DisableLogging ( ) : IDisposable
Résultat IDisposable

EnableLogging() public static 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 static EnableLogging ( ) : void
Résultat void

Flush() public static méthode

Flush any pending log messages (in case of asynchronous targets) with the default timeout of 15 seconds.
public static Flush ( ) : void
Résultat void

Flush() public static méthode

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

Flush() public static méthode

Flush any pending log messages (in case of asynchronous targets).
public static 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 static méthode

Flush any pending log messages (in case of asynchronous targets).
public static 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 static méthode

Flush any pending log messages (in case of asynchronous targets).
public static 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 static méthode

Flush any pending log messages (in case of asynchronous targets).
public static Flush ( int timeoutMilliseconds ) : void
timeoutMilliseconds int Maximum time to allow for the flush. Any messages after that time will be discarded.
Résultat void

IsLoggingEnabled() public static méthode

Checks if logging is currently enabled.
Logging is enabled if the number of EnableLogging calls is greater than or equal to DisableLogging calls.
public static IsLoggingEnabled ( ) : bool
Résultat bool

ReconfigExistingLoggers() public static 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 static ReconfigExistingLoggers ( ) : void
Résultat void

Shutdown() public static méthode

Dispose all targets, and shutdown logging.
public static Shutdown ( ) : void
Résultat void