Class LogManager
The IPhoenixLogger implementation for Phoenix.
Inherited Members
Namespace: Phoenix.Logging
Assembly: Phoenix.Core.dll
Syntax
public class LogManager : IPhoenixLogger
Properties
View SourceRegisteredCategories
Gets the list of registered categories.
Declaration
public ReadOnlyCollection<LogCategoryInfo> RegisteredCategories { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<LogCategoryInfo> |
RegisteredPrefixes
Gets the list of registered prefixes.
Declaration
public ReadOnlyCollection<PrefixConfiguration> RegisteredPrefixes { get; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<PrefixConfiguration> |
Methods
View SourceGetRegisteredCategoryById(Guid)
Gets the category info for a registered category.
Declaration
public LogCategoryInfo GetRegisteredCategoryById(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The id for the category. |
Returns
Type | Description |
---|---|
LogCategoryInfo | The category info or null if not found. |
GetRegisteredCategoryByName(String)
Gets the category info for a registered category.
Declaration
public LogCategoryInfo GetRegisteredCategoryByName(string category)
Parameters
Type | Name | Description |
---|---|---|
System.String | category | The category name. |
Returns
Type | Description |
---|---|
LogCategoryInfo | The category info or null if not found. |
IsPrefixRegistered(String)
Checks if a prefix is registered with this logger.
Declaration
public bool IsPrefixRegistered(string prefix)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the prefix is registered, false otherwise. |
Log(String, LogSeverity, String, Object[])
Logs data to any and all active loggers.
Declaration
public void Log(string prefix, LogSeverity severity, string entry, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to use. |
LogSeverity | severity | The severity level of this entry. |
System.String | entry | The log entry to write out. |
System.Object[] | parameters | Formatting parameters to use with the log entry. |
Log(String, Guid, LogSeverity, String, Object[])
Logs data to any and all active loggers.
Declaration
public void Log(string prefix, Guid categoryId, LogSeverity severity, string entry, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to use. |
System.Guid | categoryId | The id of the category to log to. |
LogSeverity | severity | The severity level of this entry. |
System.String | entry | The log entry to write out. |
System.Object[] | parameters | Formatting parameters to use with the log entry. |
Log(String, Guid, String, Object[])
Logs data to any and all active loggers.
Declaration
public void Log(string prefix, Guid categoryId, string entry, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to use. |
System.Guid | categoryId | The id of the category to log to. |
System.String | entry | The log entry to write out. |
System.Object[] | parameters | Formatting parameters to use with the log entry. |
Log(String, String, Object[])
Logs data to any and all active loggers.
Declaration
public void Log(string prefix, string entry, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to use. |
System.String | entry | The log entry to write out. |
System.Object[] | parameters | Formatting parameters to use with the log entry. |
LogCriticalException(String, Exception)
Logs an exception object to all active loggers as a Critical severity.
Declaration
public void LogCriticalException(string prefix, Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix for this exception. |
System.Exception | exception | The exception to log. |
LogCriticalException(String, Exception, Boolean)
Logs an exception object to all active loggers as a Critical severity.
Declaration
public void LogCriticalException(string prefix, Exception exception, bool logInner)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix for this exception. |
System.Exception | exception | The exception to log. |
System.Boolean | logInner | Whether or not to log the inner exception |
LogException(String, LogSeverity, Exception)
Logs an exception object to all active loggers.
Declaration
public void LogException(string prefix, LogSeverity severity, Exception exception)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix for this exception. |
LogSeverity | severity | The severity level of the exception. |
System.Exception | exception | The exception to log. |
LogException(String, LogSeverity, Exception, Boolean)
Logs an exception object to all active loggers.
Declaration
public void LogException(string prefix, LogSeverity severity, Exception exception, bool logInner)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix for this exception. |
LogSeverity | severity | The severity level of the exception. |
System.Exception | exception | The exception to log. |
System.Boolean | logInner | Whether or not to log the inner exception |
Logline(String, LogSeverity, String, Object[])
Logs data to all active loggers and includes a line break at the end.
Declaration
public void Logline(string prefix, LogSeverity severity, string entry, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to use. |
LogSeverity | severity | The severity level of this entry. |
System.String | entry | The log entry to write out. |
System.Object[] | parameters | Formatting parameters to use with the log entry. |
Logline(String, Guid, LogSeverity, String, Object[])
Logs data to all active loggers and includes a line break at the end.
Declaration
public void Logline(string prefix, Guid categoryId, LogSeverity severity, string entry, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to use. |
System.Guid | categoryId | The id of the category to log to. |
LogSeverity | severity | The severity level of this entry. |
System.String | entry | The log entry to write out. |
System.Object[] | parameters | Formatting parameters to use with the log entry. |
Logline(String, Guid, String, Object[])
Logs data to all active loggers and includes a line break at the end.
Declaration
public void Logline(string prefix, Guid categoryId, string entry, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to use. |
System.Guid | categoryId | The id of the category to log to. |
System.String | entry | The log entry to write out. |
System.Object[] | parameters | Formatting parameters to use with the log entry. |
Logline(String, String, Object[])
Logs data to any and all active loggers and includes a line break at the end.
Declaration
public void Logline(string prefix, string entry, params object[] parameters)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to use. |
System.String | entry | The log entry to write out. |
System.Object[] | parameters | Formatting parameters to use with the log entry. |
RegisterCategory(String)
Registers a category with a default severity and color for the output window.
Declaration
public Guid RegisterCategory(string category)
Parameters
Type | Name | Description |
---|---|---|
System.String | category | The name of the category being registered. |
Returns
Type | Description |
---|---|
System.Guid | The guid of the registered category. |
RegisterOutputHandler(Action<Guid, String, LogSeverity, Color>, LogSeverity[])
Registers a handler function with the logger.
Declaration
public Guid RegisterOutputHandler(Action<Guid, string, LogSeverity, Color> handler, params LogSeverity[] severities)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.Guid, System.String, LogSeverity, System.Windows.Media.Color> | handler | The function to send output to. |
LogSeverity[] | severities | The list of severities to receive. |
Returns
Type | Description |
---|---|
System.Guid | The Guid of the registered handler. |
RegisterPrefix(String, LogSeverity, Guid, Color, Boolean)
Registers a prefix with the log manager, and disables it based on the saved filter settings.
Declaration
public void RegisterPrefix(string prefix, LogSeverity defaultSeverity, Guid defaultCategoryId, Color textColor, bool showPrefix)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to register. |
LogSeverity | defaultSeverity | The default severity for this prefix. |
System.Guid | defaultCategoryId | The default category for this prefix. |
System.Windows.Media.Color | textColor | The color for this prefix. |
System.Boolean | showPrefix | True to show prefix, false otherwise. |
SetHandlerSeverities(Guid, LogSeverity[])
Sets the severity types that this handler wants to receive.
Declaration
public void SetHandlerSeverities(Guid id, params LogSeverity[] severities)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The Guid of the registered handler. |
LogSeverity[] | severities | The severity categories to receive. |
SetUnregisteredPrefixCategory(String)
Sets the category to use with a when an unregistered prefix is encountered.
Declaration
public Guid SetUnregisteredPrefixCategory(string category)
Parameters
Type | Name | Description |
---|---|---|
System.String | category | The name of the category being to set. |
Returns
Type | Description |
---|---|
System.Guid | The guid of the category. |
Remarks
If the category isn't already registered, it will register it will be registered.
StartAsync(CancellationToken)
Declaration
public Task StartAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
StopAsync(CancellationToken)
Declaration
public Task StopAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ToggleLoggingPrefix(PrefixConfiguration, ISettingsManager)
Called when user toggles an option in the filter menu and saves the result.
Declaration
public void ToggleLoggingPrefix(PrefixConfiguration prefix, ISettingsManager settingManager)
Parameters
Type | Name | Description |
---|---|---|
PrefixConfiguration | prefix | The specific prefix the user selected. |
ISettingsManager | settingManager |
UnregisterPrefix(String)
Unregisters a prefix with the log manager.
Declaration
public void UnregisterPrefix(string prefix)
Parameters
Type | Name | Description |
---|---|---|
System.String | prefix | The prefix to unregister. |
Events
View SourceRegisteredCategoriesChanged
Event to track when the registered categories have changed.
Declaration
public event EventHandler RegisteredCategoriesChanged
Event Type
Type | Description |
---|---|
System.EventHandler |
RegisteredPrefixesChanged
Event to track when the registered prefixes have changed.
Declaration
public event EventHandler RegisteredPrefixesChanged
Event Type
Type | Description |
---|---|
System.EventHandler |