Add file logging and handle unhandled exceptions (#558)
* add unhandled exception handler * added file logging * add option in config * consolidated console and file log
This commit is contained in:
parent
c1bdf19061
commit
c81abdde4c
6 changed files with 69 additions and 9 deletions
|
@ -22,7 +22,10 @@ namespace Ryujinx
|
|||
|
||||
Config.Read(device);
|
||||
|
||||
Logger.Updated += ConsoleLog.Log;
|
||||
Logger.Updated += Log.LogMessage;
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
|
||||
|
||||
if (args.Length == 1)
|
||||
{
|
||||
|
@ -87,6 +90,23 @@ namespace Ryujinx
|
|||
audioOut.Dispose();
|
||||
}
|
||||
|
||||
private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
|
||||
{
|
||||
Log.Close();
|
||||
}
|
||||
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
var exception = e.ExceptionObject as Exception;
|
||||
|
||||
Logger.PrintError(LogClass.Emulation, $"Unhandled exception caught: {exception}");
|
||||
|
||||
if (e.IsTerminating)
|
||||
{
|
||||
Log.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Picks an <see cref="IAalOutput"/> audio output renderer supported on this machine
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue