Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
More deep exception logging
Browse files Browse the repository at this point in the history
  • Loading branch information
craftersmine committed Mar 27, 2019
1 parent a732f0c commit 1a1a959
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions craftersmine.EtherEngine.Utilities/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,25 @@ public void LogException(LogEntryType prefix, Exception exception)
{
if (exception != null)
{
string[] stacktrace = exception.StackTrace.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
Log(prefix, "An exception has occurred!");
Log(prefix, "Exception message: " + exception.Message);
Log(prefix, "Exception type: " + exception.GetType().ToString());
Log(prefix, "==== START OF STACKTRACE ====");
foreach (var stln in stacktrace)
if (exception.StackTrace != null)
{
Log(prefix, stln);
string[] stacktrace = exception.StackTrace.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
Log(prefix, "==== START OF STACKTRACE ====");
foreach (var stln in stacktrace)
{
Log(prefix, stln);
}
Log(prefix, "==== END OF STACKTRACE ====");
}
else Log(prefix, "No Stacktrace collected!");
if (exception.InnerException != null)
{
Log(prefix, "");
LogException(prefix, exception.InnerException);
}
Log(prefix, "==== END OF STACKTRACE ====");
}
else
{
Expand Down

0 comments on commit 1a1a959

Please sign in to comment.