Skip to content

Commit 079b9d5

Browse files
committed
Added LogException methods.
1 parent f2381f5 commit 079b9d5

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
- Added LogException methods.
89
- Changed the size of the input field so that the text is larger.
910

1011
## [0.2.2-alpha] - 2021-08-20

Runtime/DevConsole.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,16 @@ public static void LogVariable(string variableName, object value, string suffix
241241
_console.LogVariable(variableName, value, suffix);
242242
}
243243

244+
/// <summary>
245+
/// Log an exception to the dev console.
246+
/// </summary>
247+
/// <param name="exception"></param>
248+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
249+
public static void LogException(Exception exception)
250+
{
251+
_console.LogException(exception);
252+
}
253+
244254
/// <summary>
245255
/// Log an error message to the dev console.
246256
/// </summary>

Runtime/DevConsoleMono.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,17 @@ internal void LogVariable(string variableName, object value, string suffix = "")
835835
Log($"{variableName}: {value}{suffix}.");
836836
}
837837

838+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
839+
internal void LogException(Exception exception)
840+
{
841+
if (exception == null)
842+
{
843+
return;
844+
}
845+
846+
Log($"({DateTime.Now:HH:mm:ss}) <color={ErrorColour}><b>Exception:</b> </color>{exception.Message}");
847+
}
848+
838849
[MethodImpl(MethodImplOptions.AggressiveInlining)]
839850
internal void LogError(object message)
840851
{

0 commit comments

Comments
 (0)