C# Класс NLog.LogManager

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

Private Properties

Свойство Тип Описание
AddHiddenAssembly void
CreateNullLogger Logger
GetClassFullName string
GetCurrentClassLogger Logger
GetCurrentClassLogger Logger
GetLogger Logger
GetLogger Logger
IsHiddenAssembly bool
LogManager System
LogManager_OnStopLogging void
SetupTerminationEvents void

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

Метод Описание
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.

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

Метод Описание
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

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

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 static DisableLogging ( ) : IDisposable
Результат IDisposable

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 static EnableLogging ( ) : void
Результат void

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

Flush any pending log messages (in case of asynchronous targets) with the default timeout of 15 seconds.
public static Flush ( ) : void
Результат void

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

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

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

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.
Результат void

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

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.
Результат void

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

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.
Результат void

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

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.
Результат void

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

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
Результат bool

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 static ReconfigExistingLoggers ( ) : void
Результат void

Shutdown() публичный статический Метод

Dispose all targets, and shutdown logging.
public static Shutdown ( ) : void
Результат void