Summary
The ILoggerFacade besides just having a terrible name can be somewhat problematic since it forces Prism to do a ToString on any caught exceptions that may be logged. Having the actual Exception object can be very powerful particularly when debugging.
Proposed Changes
We should first make ILoggerFacade obsolete. We will remove any internal references to it, but will keep it in the Core so as to not break anyone who may currently be using it. This will better give people an opportunity to migrate without a failed build.
There is still some benefit to the existing API as it does provide some ability to create a logger that filters based on Priority or Category. To this end we would keep a similar but updated API.
public interface ILogger
{
void Log(string message, Category category, Priority priority);
void Log(string message, Exception ex, Category category, Priority priority);
}
Additional extensions could be included here to make this easier like:
public static void Log(this ILogger logger, string message, Priority priority = Priority.None) =>
logger.Log(message, Category.Info, priority);
public static void Debug(this ILogger logger, string message, Priority priority = Priority.None) =>
logger.Log(message, Category.Debug, priority);
public static void Warn(this ILogger logger, string message, Priority priority = Priority.None) =>
logger.Log(message, Category.Warn, priority);
Additional Notes
No implementations will remain for ILoggerFacade in Prism, and thus it will not be registered out of the box as we will no longer be using it internally and only keeping the obsolete interface for those who may be using it with their own logger currently.
We will be removing the File Logger in Prism.WPF, and move the TraceLogger to Prism.Core. The DebugLogger will be replaced with a simple Console Logger.
Summary
The ILoggerFacade besides just having a terrible name can be somewhat problematic since it forces Prism to do a ToString on any caught exceptions that may be logged. Having the actual Exception object can be very powerful particularly when debugging.
Proposed Changes
We should first make ILoggerFacade obsolete. We will remove any internal references to it, but will keep it in the Core so as to not break anyone who may currently be using it. This will better give people an opportunity to migrate without a failed build.
There is still some benefit to the existing API as it does provide some ability to create a logger that filters based on Priority or Category. To this end we would keep a similar but updated API.
Additional extensions could be included here to make this easier like:
Additional Notes
No implementations will remain for
ILoggerFacadein Prism, and thus it will not be registered out of the box as we will no longer be using it internally and only keeping the obsolete interface for those who may be using it with their own logger currently.We will be removing the File Logger in Prism.WPF, and move the TraceLogger to Prism.Core. The DebugLogger will be replaced with a simple Console Logger.