feat: print all logged exceptions via Troubleshooting

This commit is contained in:
goat 2021-09-17 04:09:38 +02:00
parent 25a71574cf
commit 59ba3bdd07
No known key found for this signature in database
GPG key ID: F18F057873895461
3 changed files with 16 additions and 5 deletions

View file

@ -19,6 +19,7 @@ using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Hooking.Internal;
using Dalamud.Interface.Internal;
using Dalamud.IoC.Internal;
using Dalamud.Logging.Internal;
using Dalamud.Plugin.Internal;
using Dalamud.Plugin.Ipc.Internal;
using HarmonyLib;
@ -101,6 +102,8 @@ namespace Dalamud
{
try
{
SerilogEventSink.Instance.LogLine += SerilogOnLogLine;
Service<ServiceContainer>.Set();
// Initialize the process information.
@ -393,6 +396,14 @@ namespace Dalamud
// Log.Verbose($"Process.Handle // {__instance.ProcessName} // {__result:X}");
}
private static void SerilogOnLogLine(object? sender, (string Line, LogEventLevel Level, DateTimeOffset TimeStamp, Exception? Exception) e)
{
if (e.Exception == null)
return;
Troubleshooting.LogException(e.Exception, e.Line);
}
private void ApplyProcessPatch()
{
var harmony = new Harmony("goatcorp.dalamud");