Skip to content
This repository has been archived by the owner on Mar 6, 2018. It is now read-only.

Commit

Permalink
Allow LogError to accept an exception as an argument on IConsoleHandle (
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que committed Jun 4, 2017
1 parent d56f33e commit 26fd9e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Protogame/Console/DefaultConsoleHandle.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using Protoinject;

namespace Protogame
Expand Down Expand Up @@ -114,5 +115,10 @@ public void LogError(string messageFormat, params object[] objects)

_console.LogStructured(_node.Parent, ConsoleLogLevel.Error, messageFormat, objects);
}

public void LogError(Exception exception)
{
LogError(exception.Message + Environment.NewLine + exception.StackTrace.TrimEnd());
}
}
}
2 changes: 2 additions & 0 deletions Protogame/Console/IConsoleHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ public interface IConsoleHandle
void LogError(string messageFormat);

void LogError(string messageFormat, params object[] objects);

void LogError(Exception exception);
}
}

0 comments on commit 26fd9e5

Please sign in to comment.