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 11 months ago
parent aebdb257d0
commit 84b9db13f4

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

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

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

Loading…
Cancel
Save