From 45e5f901d12b65adfc39b183053c1323eb4c1a34 Mon Sep 17 00:00:00 2001 From: AcK77 Date: Fri, 9 Feb 2018 20:23:33 +0100 Subject: [PATCH] Logging Improvements Add Trace functions to SVC. Add function to get the function name who called. --- Ryujinx/Logging.cs | 8 +++++++- Ryujinx/OsHle/Svc/SvcHandler.cs | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Ryujinx/Logging.cs b/Ryujinx/Logging.cs index f575549eb1..101d81974f 100644 --- a/Ryujinx/Logging.cs +++ b/Ryujinx/Logging.cs @@ -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; + } } } diff --git a/Ryujinx/OsHle/Svc/SvcHandler.cs b/Ryujinx/OsHle/Svc/SvcHandler.cs index 937c341e50..9aea2dedb2 100644 --- a/Ryujinx/OsHle/Svc/SvcHandler.cs +++ b/Ryujinx/OsHle/Svc/SvcHandler.cs @@ -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 {