C# Класс Catel.Logging.LogManager

Log manager that allows external libraries to subscribe to logging of Catel. The manager automatically adds an instance of the DebugLogListener to the list of listeners so the tracing is available in debug mode. To remove this listener, call ClearListeners before doing any initialization.
Показать файл Открыть проект

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

Метод Описание
AddDebugListener ( bool ignoreCatelLogging = false ) : ILogListener

Registers the default debug listener. Starting with Catel 2.4, the debug listener is no longer attached for performance reasons. To register the debug listener, call this method. When an instance of the DebugLogListener is already registered, the existing instance is returned.

AddListener ( ILogListener listener ) : void

Adds a log listener which will receive all log events. This method does not check whether the listener is already added to the list of registered listeners.

ClearListeners ( ) : void

Clears all the current listeners.

FlushAll ( ) : void

Flushes all listeners that implement the IBatchLogListener by calling IBatchLogListener.Flush.

GetListeners ( ) : IEnumerable

Gets all the currently registered log listeners.

GetLogger ( Type type ) : ILog

Gets the logger for the specified type.

IsListenerRegistered ( ILogListener listener ) : bool

Determines whether the specified listener is already registered or not.

LoadListenersFromConfiguration ( Configuration configuration, Assembly assembly = null ) : void

Loads the listeners from the specified configuration.

LoadListenersFromConfigurationFile ( string configurationFilePath, Assembly assembly = null ) : void

Loads the listeners from the specified configuration file.

RemoveListener ( ILogListener listener ) : void

Removes the a log listener which will stop receiving all log events.

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

Метод Описание
FlushAllAsync ( ) : System.Threading.Tasks.Task
GetCurrentClassLogger ( ) : ILog
GetThreadSafeLogListeners ( ) : List

Gets the current log listeners in a thread-safe manner.

IsListenerInterested ( ILogListener listener, LogEvent logEvent ) : bool

Determines whether the specified listener is interested in the log event.

LogManager ( ) : System

Initializes static members of the LogManager class.

OnLogMessage ( object sender, LogMessageEventArgs e ) : void

Called when one of the logs has written a log message.

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

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

Registers the default debug listener. Starting with Catel 2.4, the debug listener is no longer attached for performance reasons. To register the debug listener, call this method. When an instance of the DebugLogListener is already registered, the existing instance is returned.
public static AddDebugListener ( bool ignoreCatelLogging = false ) : ILogListener
ignoreCatelLogging bool
Результат ILogListener

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

Adds a log listener which will receive all log events. This method does not check whether the listener is already added to the list of registered listeners.
The is null.
public static AddListener ( ILogListener listener ) : void
listener ILogListener The listener.
Результат void

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

Clears all the current listeners.
public static ClearListeners ( ) : void
Результат void

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

Flushes all listeners that implement the IBatchLogListener by calling IBatchLogListener.Flush.
public static FlushAll ( ) : void
Результат void

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

Gets all the currently registered log listeners.
public static GetListeners ( ) : IEnumerable
Результат IEnumerable

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

Gets the logger for the specified type.
The is null.
public static GetLogger ( Type type ) : ILog
type System.Type The type.
Результат ILog

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

Determines whether the specified listener is already registered or not.
The is null.
public static IsListenerRegistered ( ILogListener listener ) : bool
listener ILogListener The listener.
Результат bool

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

Loads the listeners from the specified configuration.
public static LoadListenersFromConfiguration ( Configuration configuration, Assembly assembly = null ) : void
configuration System.Configuration.Configuration The configuration.
assembly System.Reflection.Assembly The assembly to determine product info. If null, the entry assembly will be used.
Результат void

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

Loads the listeners from the specified configuration file.
public static LoadListenersFromConfigurationFile ( string configurationFilePath, Assembly assembly = null ) : void
configurationFilePath string The configuration file path.
assembly System.Reflection.Assembly The assembly to determine product info. If null, the entry assembly will be used.
Результат void

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

Removes the a log listener which will stop receiving all log events.
The is null.
public static RemoveListener ( ILogListener listener ) : void
listener ILogListener The listener.
Результат void