add inner exception stacktraces

This commit is contained in:
rootdarkarchon
2023-10-30 15:31:07 +01:00
parent 0f0d1e9a9d
commit 4ee0a670c0

View File

@@ -36,6 +36,13 @@ internal sealed class DalamudLogger : ILogger
StringBuilder sb = new(); StringBuilder sb = new();
sb.AppendLine($"[{_name}]{{{(int)logLevel}}} {state}: {exception?.Message}"); sb.AppendLine($"[{_name}]{{{(int)logLevel}}} {state}: {exception?.Message}");
sb.AppendLine(exception?.StackTrace); sb.AppendLine(exception?.StackTrace);
var innerException = exception?.InnerException;
while (innerException != null)
{
sb.AppendLine($"InnerException {innerException}: {innerException.Message}");
sb.AppendLine(innerException.StackTrace);
innerException = innerException.InnerException;
}
if (logLevel == LogLevel.Warning) if (logLevel == LogLevel.Warning)
_pluginLog.Warning(sb.ToString()); _pluginLog.Warning(sb.ToString());
else if (logLevel == LogLevel.Error) else if (logLevel == LogLevel.Error)