diff options
Diffstat (limited to 'Ryujinx.Common/Logging/Logger.cs')
-rw-r--r-- | Ryujinx.Common/Logging/Logger.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Ryujinx.Common/Logging/Logger.cs b/Ryujinx.Common/Logging/Logger.cs index 10b1d970..83af97b1 100644 --- a/Ryujinx.Common/Logging/Logger.cs +++ b/Ryujinx.Common/Logging/Logger.cs @@ -37,6 +37,12 @@ namespace Ryujinx.Common.Logging m_LogTargets = new List<ILogTarget>(); m_Time = Stopwatch.StartNew(); + + // Logger should log to console by default + AddTarget(new AsyncLogTargetWrapper( + new ConsoleLogTarget("console"), + 1000, + AsyncLogTargetOverflowAction.Block)); } public static void RestartTime() @@ -44,6 +50,19 @@ namespace Ryujinx.Common.Logging m_Time.Restart(); } + private static ILogTarget GetTarget(string targetName) + { + foreach (var target in m_LogTargets) + { + if (target.Name.Equals(targetName)) + { + return target; + } + } + + return null; + } + public static void AddTarget(ILogTarget target) { m_LogTargets.Add(target); @@ -51,6 +70,20 @@ namespace Ryujinx.Common.Logging Updated += target.Log; } + public static void RemoveTarget(string target) + { + ILogTarget logTarget = GetTarget(target); + + if (logTarget != null) + { + Updated -= logTarget.Log; + + m_LogTargets.Remove(logTarget); + + logTarget.Dispose(); + } + } + public static void Shutdown() { Updated = null; |