aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Logging/LogHelper.cs
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-21 20:26:35 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-21 20:26:35 -0500
commitfdafa596832eae13cebcf5bbe5fa867f7ba068f0 (patch)
treeeee891c8f11564d4b14868d11f4758f243c112ce /MediaBrowser.Common/Logging/LogHelper.cs
parent931c0ea455161b8ee00005a0ffd1f8afab41f7bb (diff)
Removed System.Windows.Forms dependancy from Common. Almost done removing NLog dependancy.
Diffstat (limited to 'MediaBrowser.Common/Logging/LogHelper.cs')
-rw-r--r--MediaBrowser.Common/Logging/LogHelper.cs90
1 files changed, 0 insertions, 90 deletions
diff --git a/MediaBrowser.Common/Logging/LogHelper.cs b/MediaBrowser.Common/Logging/LogHelper.cs
deleted file mode 100644
index 8b638a28e..000000000
--- a/MediaBrowser.Common/Logging/LogHelper.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-using System.Text;
-
-namespace MediaBrowser.Common.Logging
-{
- /// <summary>
- /// Class LogHelper
- /// </summary>
- public static class LogHelper
- {
- /// <summary>
- /// Gets the log message.
- /// </summary>
- /// <param name="exception">The exception.</param>
- /// <returns>StringBuilder.</returns>
- public static StringBuilder GetLogMessage(Exception 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;
- }
-
- /// <summary>
- /// Appends the inner exceptions.
- /// </summary>
- /// <param name="messageText">The message text.</param>
- /// <param name="e">The e.</param>
- 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);
- }
- }
-
- else if (e.InnerException != null)
- {
- AppendInnerException(messageText, e.InnerException);
- }
- }
-
- /// <summary>
- /// Appends the inner exception.
- /// </summary>
- /// <param name="messageText">The message text.</param>
- /// <param name="e">The e.</param>
- 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);
- }
- }
-
- /// <summary>
- /// Logs the exception data.
- /// </summary>
- /// <param name="messageText">The message text.</param>
- /// <param name="e">The e.</param>
- private static void LogExceptionData(StringBuilder messageText, Exception e)
- {
- foreach (var key in e.Data.Keys)
- {
- messageText.AppendLine(key + ": " + e.Data[key]);
- }
- }
- }
-}