diff --git a/Ryujinx.Common/Logging/LogLevel.cs b/Ryujinx.Common/Logging/LogLevel.cs index b1c2d23bf6..8857fb45a0 100644 --- a/Ryujinx.Common/Logging/LogLevel.cs +++ b/Ryujinx.Common/Logging/LogLevel.cs @@ -9,6 +9,7 @@ namespace Ryujinx.Common.Logging Error, Guest, AccessLog, - Notice + Notice, + Trace } } diff --git a/Ryujinx.Common/Logging/Logger.cs b/Ryujinx.Common/Logging/Logger.cs index 040a555b66..475e36281e 100644 --- a/Ryujinx.Common/Logging/Logger.cs +++ b/Ryujinx.Common/Logging/Logger.cs @@ -90,6 +90,7 @@ namespace Ryujinx.Common.Logging public static Log? Guest { get; private set; } public static Log? AccessLog { get; private set; } public static Log? Stub { get; private set; } + public static Log? Trace { get; private set; } public static Log Notice { get; } // Always enabled static Logger() @@ -117,6 +118,7 @@ namespace Ryujinx.Common.Logging Error = new Log(LogLevel.Error); Warning = new Log(LogLevel.Warning); Info = new Log(LogLevel.Info); + Trace = new Log(LogLevel.Trace); } public static void RestartTime() @@ -172,7 +174,7 @@ namespace Ryujinx.Common.Logging public static IReadOnlyCollection GetEnabledLevels() { - var logs = new Log?[] { Debug, Info, Warning, Error, Guest, AccessLog, Stub }; + var logs = new Log?[] { Debug, Info, Warning, Error, Guest, AccessLog, Stub, Trace }; List levels = new List(logs.Length); foreach (var log in logs) { @@ -196,6 +198,7 @@ namespace Ryujinx.Common.Logging case LogLevel.Guest : Guest = enabled ? new Log(LogLevel.Guest) : new Log?(); break; case LogLevel.AccessLog : AccessLog = enabled ? new Log(LogLevel.AccessLog): new Log?(); break; case LogLevel.Stub : Stub = enabled ? new Log(LogLevel.Stub) : new Log?(); break; + case LogLevel.Trace : Trace = enabled ? new Log(LogLevel.Trace) : new Log?(); break; default: throw new ArgumentException("Unknown Log Level"); } } diff --git a/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs b/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs index 15f0e1530b..54e9e85cf1 100644 --- a/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs +++ b/Ryujinx.Common/Logging/Targets/ConsoleLogTarget.cs @@ -17,6 +17,7 @@ namespace Ryujinx.Common.Logging LogLevel.Error => ConsoleColor.Red, LogLevel.Stub => ConsoleColor.DarkGray, LogLevel.Notice => ConsoleColor.Cyan, + LogLevel.Trace => ConsoleColor.DarkCyan, _ => ConsoleColor.Gray, }; diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs index 91ab4d96ba..9f6b0a3090 100644 --- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs +++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SyscallTable.cs @@ -479,7 +479,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } else { - Logger.Debug?.Print(LogClass.KernelSvc, $"{svcName} returned result {result}."); + Logger.Trace?.Print(LogClass.KernelSvc, $"{svcName} returned result {result}."); } } } diff --git a/Ryujinx.HLE/HOS/Services/IpcService.cs b/Ryujinx.HLE/HOS/Services/IpcService.cs index 108a4f7005..526565a58c 100644 --- a/Ryujinx.HLE/HOS/Services/IpcService.cs +++ b/Ryujinx.HLE/HOS/Services/IpcService.cs @@ -117,7 +117,7 @@ namespace Ryujinx.HLE.HOS.Services if (serviceExists) { - Logger.Debug?.Print(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Name}"); + Logger.Trace?.Print(LogClass.KernelIpc, $"{service.GetType().Name}: {processRequest.Name}"); result = (ResultCode)processRequest.Invoke(service, new object[] { context }); } diff --git a/Ryujinx.Headless.SDL2/Options.cs b/Ryujinx.Headless.SDL2/Options.cs index 2b52dfbe1e..4c9b83c4de 100644 --- a/Ryujinx.Headless.SDL2/Options.cs +++ b/Ryujinx.Headless.SDL2/Options.cs @@ -135,6 +135,9 @@ namespace Ryujinx.Headless.SDL2 [Option("enable-error-logs", Required = false, Default = true, HelpText = "Enables printing error log messages.")] public bool? LoggingEnableError { get; set; } + [Option("enable-trace-logs", Required = false, Default = false, HelpText = "Enables printing trace log messages.")] + public bool? LoggingEnableTrace { get; set; } + [Option("enable-guest-logs", Required = false, Default = true, HelpText = "Enables printing guest log messages.")] public bool? LoggingEnableGuest { get; set; } diff --git a/Ryujinx.Headless.SDL2/Program.cs b/Ryujinx.Headless.SDL2/Program.cs index 14c7236035..973b4f5e48 100644 --- a/Ryujinx.Headless.SDL2/Program.cs +++ b/Ryujinx.Headless.SDL2/Program.cs @@ -389,6 +389,7 @@ namespace Ryujinx.Headless.SDL2 Logger.SetEnable(LogLevel.Info, (bool)option.LoggingEnableInfo); Logger.SetEnable(LogLevel.Warning, (bool)option.LoggingEnableWarning); Logger.SetEnable(LogLevel.Error, (bool)option.LoggingEnableError); + Logger.SetEnable(LogLevel.Trace, (bool)option.LoggingEnableTrace); Logger.SetEnable(LogLevel.Guest, (bool)option.LoggingEnableGuest); Logger.SetEnable(LogLevel.AccessLog, (bool)option.LoggingEnableFsAccessLog); diff --git a/Ryujinx/Configuration/ConfigurationFileFormat.cs b/Ryujinx/Configuration/ConfigurationFileFormat.cs index 9eb11a9e7a..8e64aa081f 100644 --- a/Ryujinx/Configuration/ConfigurationFileFormat.cs +++ b/Ryujinx/Configuration/ConfigurationFileFormat.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 35; + public const int CurrentVersion = 36; /// /// Version of the configuration file format @@ -81,6 +81,11 @@ namespace Ryujinx.Configuration /// public bool LoggingEnableError { get; set; } + /// + /// Enables printing trace log messages + /// + public bool LoggingEnableTrace { get; set; } + /// /// Enables printing guest log messages /// diff --git a/Ryujinx/Configuration/ConfigurationState.cs b/Ryujinx/Configuration/ConfigurationState.cs index fdc28201e9..0b495ab766 100644 --- a/Ryujinx/Configuration/ConfigurationState.cs +++ b/Ryujinx/Configuration/ConfigurationState.cs @@ -129,6 +129,11 @@ namespace Ryujinx.Configuration /// public ReactiveObject EnableError { get; private set; } + /// + /// Enables printing trace log messages + /// + public ReactiveObject EnableTrace { get; private set; } + /// /// Enables printing guest log messages /// @@ -161,6 +166,7 @@ namespace Ryujinx.Configuration EnableInfo = new ReactiveObject(); EnableWarn = new ReactiveObject(); EnableError = new ReactiveObject(); + EnableTrace = new ReactiveObject(); EnableGuest = new ReactiveObject(); EnableFsAccessLog = new ReactiveObject(); FilteredClasses = new ReactiveObject(); @@ -455,6 +461,7 @@ namespace Ryujinx.Configuration LoggingEnableInfo = Logger.EnableInfo, LoggingEnableWarn = Logger.EnableWarn, LoggingEnableError = Logger.EnableError, + LoggingEnableTrace = Logger.EnableTrace, LoggingEnableGuest = Logger.EnableGuest, LoggingEnableFsAccessLog = Logger.EnableFsAccessLog, LoggingFilteredClasses = Logger.FilteredClasses, @@ -526,6 +533,7 @@ namespace Ryujinx.Configuration Logger.EnableInfo.Value = true; Logger.EnableWarn.Value = true; Logger.EnableError.Value = true; + Logger.EnableTrace.Value = false; Logger.EnableGuest.Value = true; Logger.EnableFsAccessLog.Value = false; Logger.FilteredClasses.Value = Array.Empty(); @@ -990,6 +998,15 @@ namespace Ryujinx.Configuration configurationFileUpdated = true; } + + if (configurationFileFormat.Version < 36) + { + Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 36."); + + configurationFileFormat.LoggingEnableTrace = false; + + configurationFileUpdated = true; + } Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog; Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading; @@ -1003,6 +1020,7 @@ namespace Ryujinx.Configuration Logger.EnableInfo.Value = configurationFileFormat.LoggingEnableInfo; Logger.EnableWarn.Value = configurationFileFormat.LoggingEnableWarn; Logger.EnableError.Value = configurationFileFormat.LoggingEnableError; + Logger.EnableTrace.Value = configurationFileFormat.LoggingEnableTrace; Logger.EnableGuest.Value = configurationFileFormat.LoggingEnableGuest; Logger.EnableFsAccessLog.Value = configurationFileFormat.LoggingEnableFsAccessLog; Logger.FilteredClasses.Value = configurationFileFormat.LoggingFilteredClasses; diff --git a/Ryujinx/Configuration/LoggerModule.cs b/Ryujinx/Configuration/LoggerModule.cs index 2599eeffa2..9e81f72566 100644 --- a/Ryujinx/Configuration/LoggerModule.cs +++ b/Ryujinx/Configuration/LoggerModule.cs @@ -13,6 +13,7 @@ namespace Ryujinx.Configuration ConfigurationState.Instance.Logger.EnableInfo.Event += ReloadEnableInfo; ConfigurationState.Instance.Logger.EnableWarn.Event += ReloadEnableWarning; ConfigurationState.Instance.Logger.EnableError.Event += ReloadEnableError; + ConfigurationState.Instance.Logger.EnableTrace.Event += ReloadEnableTrace; ConfigurationState.Instance.Logger.EnableGuest.Event += ReloadEnableGuest; ConfigurationState.Instance.Logger.EnableFsAccessLog.Event += ReloadEnableFsAccessLog; ConfigurationState.Instance.Logger.FilteredClasses.Event += ReloadFilteredClasses; @@ -44,6 +45,11 @@ namespace Ryujinx.Configuration Logger.SetEnable(LogLevel.Error, e.NewValue); } + private static void ReloadEnableTrace(object sender, ReactiveEventArgs e) + { + Logger.SetEnable(LogLevel.Trace, e.NewValue); + } + private static void ReloadEnableGuest(object sender, ReactiveEventArgs e) { Logger.SetEnable(LogLevel.Guest, e.NewValue); diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index cc3c12396e..9268930710 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -638,18 +638,18 @@ namespace Ryujinx.Ui [Conditional("RELEASE")] public void PerformanceCheck() { - if (ConfigurationState.Instance.Logger.EnableDebug.Value) + if (ConfigurationState.Instance.Logger.EnableTrace.Value) { MessageDialog debugWarningDialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo, null) { Title = "Ryujinx - Warning", - Text = "You have debug logging enabled, which is designed to be used by developers only.", - SecondaryText = "For optimal performance, it's recommended to disable debug logging. Would you like to disable debug logging now?" + Text = "You have trace logging enabled, which is designed to be used by developers only.", + SecondaryText = "For optimal performance, it's recommended to disable trace logging. Would you like to disable trace logging now?" }; if (debugWarningDialog.Run() == (int)ResponseType.Yes) { - ConfigurationState.Instance.Logger.EnableDebug.Value = false; + ConfigurationState.Instance.Logger.EnableTrace.Value = false; SaveConfig(); } diff --git a/Ryujinx/Ui/Windows/SettingsWindow.cs b/Ryujinx/Ui/Windows/SettingsWindow.cs index 8434d652bb..2b423081e5 100644 --- a/Ryujinx/Ui/Windows/SettingsWindow.cs +++ b/Ryujinx/Ui/Windows/SettingsWindow.cs @@ -35,6 +35,7 @@ namespace Ryujinx.Ui.Windows private float _previousVolumeLevel; #pragma warning disable CS0649, IDE0044 + [GUI] CheckButton _traceLogToggle; [GUI] CheckButton _errorLogToggle; [GUI] CheckButton _warningLogToggle; [GUI] CheckButton _infoLogToggle; @@ -141,6 +142,11 @@ namespace Ryujinx.Ui.Windows }; // Setup Currents. + if (ConfigurationState.Instance.Logger.EnableTrace) + { + _traceLogToggle.Click(); + } + if (ConfigurationState.Instance.Logger.EnableFileLog) { _fileLogToggle.Click(); @@ -487,6 +493,7 @@ namespace Ryujinx.Ui.Windows } ConfigurationState.Instance.Logger.EnableError.Value = _errorLogToggle.Active; + ConfigurationState.Instance.Logger.EnableTrace.Value = _traceLogToggle.Active; ConfigurationState.Instance.Logger.EnableWarn.Value = _warningLogToggle.Active; ConfigurationState.Instance.Logger.EnableInfo.Value = _infoLogToggle.Active; ConfigurationState.Instance.Logger.EnableStub.Value = _stubLogToggle.Active; diff --git a/Ryujinx/Ui/Windows/SettingsWindow.glade b/Ryujinx/Ui/Windows/SettingsWindow.glade index d9b36daf6c..c9d19a27f1 100644 --- a/Ryujinx/Ui/Windows/SettingsWindow.glade +++ b/Ryujinx/Ui/Windows/SettingsWindow.glade @@ -2572,6 +2572,24 @@ 21 + + + Enable Trace Logs + True + True + False + Enables printing trace log messages + start + 5 + 5 + True + + + False + True + 22 + + False