aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Common/Logging/Logger.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-06-01 15:47:53 +0200
committerGitHub <noreply@github.com>2023-06-01 13:47:53 +0000
commitf4539c49d8def4c6086a61fe4bd9ed9665fac4b1 (patch)
treea8c22c3b1fb8bbe4a7affc931da7f7c4abd04c8d /src/Ryujinx.Common/Logging/Logger.cs
parent12c62fdbc223af1fcd0aca9f0146a6dff38ec1b3 (diff)
[Logger] Add print with stacktrace method (#5129)1.1.852
* Add print with stacktrace method * Adjust logging namespaces * Add static keyword to DynamicObjectFormatter
Diffstat (limited to 'src/Ryujinx.Common/Logging/Logger.cs')
-rw-r--r--src/Ryujinx.Common/Logging/Logger.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Ryujinx.Common/Logging/Logger.cs b/src/Ryujinx.Common/Logging/Logger.cs
index 4d48dd48..25f9c5ee 100644
--- a/src/Ryujinx.Common/Logging/Logger.cs
+++ b/src/Ryujinx.Common/Logging/Logger.cs
@@ -1,3 +1,4 @@
+using Ryujinx.Common.Logging.Targets;
using Ryujinx.Common.SystemInterop;
using System;
using System.Collections.Generic;
@@ -55,6 +56,16 @@ namespace Ryujinx.Common.Logging
}
}
+ [StackTraceHidden]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void PrintStack(LogClass logClass, string message, [CallerMemberName] string caller = "")
+ {
+ if (m_EnabledClasses[(int)logClass])
+ {
+ Updated?.Invoke(null, new LogEventArgs(Level, m_Time.Elapsed, Thread.CurrentThread.Name, FormatMessage(logClass, caller, message), new StackTrace(true)));
+ }
+ }
+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PrintStub(LogClass logClass, string message = "", [CallerMemberName] string caller = "")
{
@@ -122,7 +133,7 @@ namespace Ryujinx.Common.Logging
AsyncLogTargetOverflowAction.Discard));
Notice = new Log(LogLevel.Notice);
-
+
// Enable important log levels before configuration is loaded
Error = new Log(LogLevel.Error);
Warning = new Log(LogLevel.Warning);
@@ -221,4 +232,4 @@ namespace Ryujinx.Common.Logging
m_EnabledClasses[(int)logClass] = enabled;
}
}
-}
+} \ No newline at end of file