C# Class 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.
Afficher le fichier Open project: Catel/Catel

Méthodes publiques

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

Private Methods

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

Method Details

AddDebugListener() public static méthode

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

AddListener() public static méthode

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

ClearListeners() public static méthode

Clears all the current listeners.
public static ClearListeners ( ) : void
Résultat void

FlushAll() public static méthode

Flushes all listeners that implement the IBatchLogListener by calling IBatchLogListener.Flush.
public static FlushAll ( ) : void
Résultat void

GetListeners() public static méthode

Gets all the currently registered log listeners.
public static GetListeners ( ) : IEnumerable
Résultat IEnumerable

GetLogger() public static méthode

Gets the logger for the specified type.
The is null.
public static GetLogger ( Type type ) : ILog
type System.Type The type.
Résultat ILog

IsListenerRegistered() public static méthode

Determines whether the specified listener is already registered or not.
The is null.
public static IsListenerRegistered ( ILogListener listener ) : bool
listener ILogListener The listener.
Résultat bool

LoadListenersFromConfiguration() public static méthode

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

LoadListenersFromConfigurationFile() public static méthode

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

RemoveListener() public static méthode

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