refactor: Print full exception stack trace to console

Previously, the exception stack trace was omitted to simplify the
console output. However, some situations occurred where an exception was
logged but I couldn't tell where it came from. This made certain rare
bugs impossible to fix.

My philosophy at this point is: If something exceptional happens, we
don't really care about a "clean" console output anymore...
pull/201/head
Robert Dailey 10 months ago
parent aebdb257d0
commit 84b9db13f4

@ -31,9 +31,7 @@ public class LoggerFactory
private static ExpressionTemplate GetConsoleTemplate()
{
var template = "[{@l:u3}] " + GetBaseTemplateString() +
"{#if ExceptionMessage is not null}: {ExceptionMessage}{#end}" +
"\n";
var template = "[{@l:u3}] " + GetBaseTemplateString() + "\n{@x}";
return new ExpressionTemplate(template, theme: TemplateTheme.Code);
}

@ -112,8 +112,6 @@ public class SyncProcessor : ISyncProcessor
private void HandleException(Exception e)
{
_log.Debug(e, "Sync Processor Exception");
switch (e)
{
case GitCmdException e2:

@ -53,8 +53,14 @@ internal static class Program
}
catch (Exception ex)
{
AnsiConsole.WriteException(ex, ExceptionFormats.ShortenEverything);
_log?.Debug(ex, "Non-recoverable Exception");
if (_log is null)
{
AnsiConsole.WriteException(ex, ExceptionFormats.ShortenEverything);
}
else
{
_log.Error(ex, "Non-recoverable Exception");
}
}
finally
{

Loading…
Cancel
Save