Logging Improvements

Add Trace functions to SVC.
Add function to get the function name who called.
This commit is contained in:
AcK77 2018-02-09 20:23:33 +01:00
parent a913c620bd
commit 45e5f901d1
2 changed files with 9 additions and 1 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
namespace Ryujinx
@ -59,7 +60,7 @@ namespace Ryujinx
{
if (EnableTrace)
{
string Text = $"{GetExecutionTime()} | TRACE > {Message}";
string Text = $"{GetExecutionTime()} | TRACE > {WhoCalledMe()} - {Message}";
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.WriteLine(Text.PadLeft(Text.Length + 1, ' '));
@ -124,5 +125,10 @@ namespace Ryujinx
LogFile(Text);
}
}
private static string WhoCalledMe()
{
return new StackTrace().GetFrame(2).GetMethod().Name;
}
}
}

View file

@ -69,7 +69,9 @@ namespace Ryujinx.OsHle.Svc
if (SvcFuncs.TryGetValue(e.Id, out SvcFunc Func))
{
Logging.Trace($"{Func.Method.Name} called.");
Func(Ns, Registers, Memory);
Logging.Trace($"{Func.Method.Name} ended.");
}
else
{