From ce38e987910b4badb4c40844786449458b2d3229 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 29 Oct 2016 00:10:11 -0400 Subject: move common dependencies --- .../Logging/LogHelper.cs | 97 ---------------------- 1 file changed, 97 deletions(-) delete mode 100644 MediaBrowser.Common.Implementations/Logging/LogHelper.cs (limited to 'MediaBrowser.Common.Implementations/Logging/LogHelper.cs') diff --git a/MediaBrowser.Common.Implementations/Logging/LogHelper.cs b/MediaBrowser.Common.Implementations/Logging/LogHelper.cs deleted file mode 100644 index 8080c2111c..0000000000 --- a/MediaBrowser.Common.Implementations/Logging/LogHelper.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Text; - -namespace MediaBrowser.Common.Implementations.Logging -{ - /// - /// Class LogHelper - /// - public static class LogHelper - { - /// - /// Gets the log message. - /// - /// The exception. - /// StringBuilder. - public static StringBuilder GetLogMessage(Exception exception) - { - if (exception == null) - { - throw new ArgumentNullException("exception"); - } - - var messageText = new StringBuilder(); - - messageText.AppendLine(exception.Message); - - messageText.AppendLine(exception.GetType().FullName); - - LogExceptionData(messageText, exception); - - messageText.AppendLine(exception.StackTrace ?? "No Stack Trace Available"); - - // Log the InnerExceptions, if any - AppendInnerExceptions(messageText, exception); - - messageText.AppendLine(string.Empty); - - return messageText; - } - - /// - /// Appends the inner exceptions. - /// - /// The message text. - /// The e. - private static void AppendInnerExceptions(StringBuilder messageText, Exception e) - { - var aggregate = e as AggregateException; - - if (aggregate != null && aggregate.InnerExceptions != null) - { - foreach (var ex in aggregate.InnerExceptions) - { - AppendInnerException(messageText, ex); - AppendInnerExceptions(messageText, ex); - } - } - - else if (e.InnerException != null) - { - AppendInnerException(messageText, e.InnerException); - AppendInnerExceptions(messageText, e.InnerException); - } - } - - /// - /// Appends the inner exception. - /// - /// The message text. - /// The e. - private static void AppendInnerException(StringBuilder messageText, Exception e) - { - messageText.AppendLine("InnerException: " + e.GetType().FullName); - messageText.AppendLine(e.Message); - - LogExceptionData(messageText, e); - - if (e.StackTrace != null) - { - messageText.AppendLine(e.StackTrace); - } - } - - /// - /// Logs the exception data. - /// - /// The message text. - /// The e. - private static void LogExceptionData(StringBuilder messageText, Exception e) - { - foreach (var key in e.Data.Keys) - { - messageText.AppendLine(key + ": " + e.Data[key]); - } - } - } -} -- cgit v1.2.3