C# Class NLog.LogManager

Creates and manages instances of T:NLog.Logger objects.
Datei anzeigen Open project: NLog/NLog Class Usage Examples

Private Properties

Property 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

Public Methods

Method 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

Method 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 method

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
return IDisposable

EnableLogging() public static method

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
return void

Flush() public static method

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

Flush() public static method

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

Flush() public static method

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.
return void

Flush() public static method

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.
return void

Flush() public static method

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.
return void

Flush() public static method

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.
return void

IsLoggingEnabled() public static method

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
return bool

ReconfigExistingLoggers() public static method

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
return void

Shutdown() public static method

Dispose all targets, and shutdown logging.
public static Shutdown ( ) : void
return void