aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common/Logging
diff options
context:
space:
mode:
authormerry <git@mary.rs>2023-02-25 15:07:23 +0000
committerGitHub <noreply@github.com>2023-02-25 15:07:23 +0000
commit9b1cc2cec6135602efc5dc5afa45ed3db261eb42 (patch)
tree7c73dcbcadcd1430ca7229a8ddd85054bb7b85ce /Ryujinx.Common/Logging
parente691622f0a118d550a7891896e40b0d9ab39fb60 (diff)
Logging: Redirect StdErr into logging system (#4427)1.1.643
* Logging: Redirect StdErr into logging system * Remove Mono.Unix * Apply suggestions from code review Co-authored-by: riperiperi <rhy3756547@hotmail.com> * Address comments --------- Co-authored-by: Mary <thog@protonmail.com> Co-authored-by: riperiperi <rhy3756547@hotmail.com> Co-authored-by: Mary <mary@mary.zone>
Diffstat (limited to 'Ryujinx.Common/Logging')
-rw-r--r--Ryujinx.Common/Logging/Logger.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/Ryujinx.Common/Logging/Logger.cs b/Ryujinx.Common/Logging/Logger.cs
index c1abdba9..4d48dd48 100644
--- a/Ryujinx.Common/Logging/Logger.cs
+++ b/Ryujinx.Common/Logging/Logger.cs
@@ -1,3 +1,4 @@
+using Ryujinx.Common.SystemInterop;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -14,6 +15,8 @@ namespace Ryujinx.Common.Logging
private static readonly List<ILogTarget> m_LogTargets;
+ private static readonly StdErrAdapter _stdErrAdapter;
+
public static event EventHandler<LogEventArgs> Updated;
public readonly struct Log
@@ -77,7 +80,13 @@ namespace Ryujinx.Common.Logging
{
Updated?.Invoke(null, new LogEventArgs(Level, m_Time.Elapsed, Thread.CurrentThread.Name, FormatMessage(logClass, caller, "Stubbed. " + message), data));
}
- }
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void PrintRawMsg(string message)
+ {
+ Updated?.Invoke(null, new LogEventArgs(Level, m_Time.Elapsed, Thread.CurrentThread.Name, message));
+ }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static string FormatMessage(LogClass Class, string Caller, string Message) => $"{Class} {Caller}: {Message}";
@@ -119,6 +128,8 @@ namespace Ryujinx.Common.Logging
Warning = new Log(LogLevel.Warning);
Info = new Log(LogLevel.Info);
Trace = new Log(LogLevel.Trace);
+
+ _stdErrAdapter = new StdErrAdapter();
}
public static void RestartTime()
@@ -164,6 +175,8 @@ namespace Ryujinx.Common.Logging
{
Updated = null;
+ _stdErrAdapter.Dispose();
+
foreach (var target in m_LogTargets)
{
target.Dispose();