diff --git a/Directory.Build.props b/Directory.Build.props index 811adfbafb..4b8397d445 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,7 +23,7 @@ changes! --> 3.0.27 - 8 + 9 $(NitrocidModAPIVersionMajor).$(NitrocidModAPIVersionChangeset) diff --git a/private/Nitrocid.Tests/InitTest.cs b/private/Nitrocid.Tests/InitTest.cs index 5d9d2fdab4..58994fc66a 100644 --- a/private/Nitrocid.Tests/InitTest.cs +++ b/private/Nitrocid.Tests/InitTest.cs @@ -70,9 +70,9 @@ public static void ReadyEverything(TestContext tc) Making.MakeDirectory(PathToTestSlotFolder, false); // Enable debugging - string debugPath = Environment.CurrentDirectory + "/UnitTestDebug.log"; - DebugWriter.DebugPath = debugPath; KernelEntry.DebugMode = true; + string debugPath = Environment.CurrentDirectory + "/UnitTestDebug.log"; + DebugWriter.InitializeDebug(debugPath); // Load necessary addons for testing AddonTools.ProcessAddons(ModLoadPriority.Important); diff --git a/public/Nitrocid.Templates/templates/KSMod/ModName.cs b/public/Nitrocid.Templates/templates/KSMod/ModName.cs index 0fc3f204a9..213fd26766 100644 --- a/public/Nitrocid.Templates/templates/KSMod/ModName.cs +++ b/public/Nitrocid.Templates/templates/KSMod/ModName.cs @@ -10,7 +10,7 @@ public class ModName : IMod public string Name { get; set; } = "My Mod"; public string Version { get; set; } = "1.0.0"; - public Version MinimumSupportedApiVersion => new(3, 0, 27, 8); + public Version MinimumSupportedApiVersion => new(3, 0, 27, 9); public ReadOnlyDictionary PubliclyAvailableFunctions => null; diff --git a/public/Nitrocid/Arguments/CommandLineArguments/Reset.cs b/public/Nitrocid/Arguments/CommandLineArguments/Reset.cs index ed58ffd967..20662cc65e 100644 --- a/public/Nitrocid/Arguments/CommandLineArguments/Reset.cs +++ b/public/Nitrocid/Arguments/CommandLineArguments/Reset.cs @@ -28,6 +28,7 @@ using Terminaux.Writer.ConsoleWriters; using Nitrocid.Files.Operations.Querying; using Nitrocid.Kernel.Power; +using Nitrocid.Kernel.Debugging; namespace Nitrocid.Arguments.CommandLineArguments { @@ -53,12 +54,6 @@ public override void Execute(ArgumentParameters parameters) foreach (string recent in recents) File.Delete(recent); break; - case KernelPathType.Debugging: - TargetPath = TargetPath[..TargetPath.LastIndexOf(".log")] + "*.log"; - string[] debugs = Listing.GetFilesystemEntries(TargetPath); - foreach (string debug in debugs) - File.Delete(debug); - break; case KernelPathType.Journaling: TargetPath = TargetPath[..TargetPath.LastIndexOf(".json")] + "*.json"; string[] journals = Listing.GetFilesystemEntries(TargetPath); @@ -94,6 +89,16 @@ public override void Execute(ArgumentParameters parameters) } } + // Wipe debug logs + try + { + DebugWriter.RemoveDebugLogs(); + } + catch (Exception ex) + { + TextWriters.Write(Translate.DoTranslation("Can't wipe debug files") + $": {ex.Message}", true, KernelColorType.Error); + } + // Inform user that the wipe was not complete if there are files. string[] files = Listing.GetFilesystemEntries(PathsManagement.AppDataPath); if (files.Length > 0) diff --git a/public/Nitrocid/Drivers/DebugLogger/BaseDebugLoggerDriver.cs b/public/Nitrocid/Drivers/DebugLogger/BaseDebugLoggerDriver.cs index 9fdb0fb9eb..f0337bb36e 100644 --- a/public/Nitrocid/Drivers/DebugLogger/BaseDebugLoggerDriver.cs +++ b/public/Nitrocid/Drivers/DebugLogger/BaseDebugLoggerDriver.cs @@ -38,11 +38,11 @@ public abstract class BaseDebugLoggerDriver : IDebugLoggerDriver public virtual bool DriverInternal => false; /// - public virtual void Write(string text) => - DebugWriter.DebugStreamWriter?.Write(text); + public virtual void Write(string text, DebugLevel level) => + DebugWriter.DeterministicDebug(text, level, null); /// - public virtual void Write(string text, params object[] vars) => - DebugWriter.DebugStreamWriter?.Write(text, vars); + public virtual void Write(string text, DebugLevel level, params object[] vars) => + DebugWriter.DeterministicDebug(text, level, vars); } } diff --git a/public/Nitrocid/Drivers/DebugLogger/Bases/ConsoleDebugLogger.cs b/public/Nitrocid/Drivers/DebugLogger/Bases/ConsoleDebugLogger.cs index 34d3f737e3..8879ba0b98 100644 --- a/public/Nitrocid/Drivers/DebugLogger/Bases/ConsoleDebugLogger.cs +++ b/public/Nitrocid/Drivers/DebugLogger/Bases/ConsoleDebugLogger.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using Nitrocid.Kernel.Debugging; using Terminaux.Writer.ConsoleWriters; namespace Nitrocid.Drivers.DebugLogger.Bases @@ -30,11 +31,11 @@ internal class ConsoleDebugLogger : BaseDebugLoggerDriver, IDebugLoggerDriver public override bool DriverInternal => true; /// - public override void Write(string text) => + public override void Write(string text, DebugLevel level) => TextWriterColor.Write(text, false); /// - public override void Write(string text, params object[] vars) => + public override void Write(string text, DebugLevel level, params object[] vars) => TextWriterColor.Write(text, false, vars); } } diff --git a/public/Nitrocid/Drivers/DebugLogger/Bases/UnitTestDebugLogger.cs b/public/Nitrocid/Drivers/DebugLogger/Bases/UnitTestDebugLogger.cs index 161f286f80..a478823cf8 100644 --- a/public/Nitrocid/Drivers/DebugLogger/Bases/UnitTestDebugLogger.cs +++ b/public/Nitrocid/Drivers/DebugLogger/Bases/UnitTestDebugLogger.cs @@ -17,6 +17,7 @@ // along with this program. If not, see . // +using Nitrocid.Kernel.Debugging; using Terminal = System.Console; namespace Nitrocid.Drivers.DebugLogger.Bases @@ -30,11 +31,11 @@ internal class UnitTestDebugLogger : BaseDebugLoggerDriver, IDebugLoggerDriver public override bool DriverInternal => true; /// - public override void Write(string text) => + public override void Write(string text, DebugLevel level) => Terminal.Write(text); /// - public override void Write(string text, params object[] vars) => + public override void Write(string text, DebugLevel level, params object[] vars) => Terminal.Write(text, vars); } } diff --git a/public/Nitrocid/Drivers/DebugLogger/IDebugLoggerDriver.cs b/public/Nitrocid/Drivers/DebugLogger/IDebugLoggerDriver.cs index 8c3040e3bb..700da31f09 100644 --- a/public/Nitrocid/Drivers/DebugLogger/IDebugLoggerDriver.cs +++ b/public/Nitrocid/Drivers/DebugLogger/IDebugLoggerDriver.cs @@ -17,6 +17,8 @@ // along with this program. If not, see . // +using Nitrocid.Kernel.Debugging; + namespace Nitrocid.Drivers.DebugLogger { /// @@ -28,13 +30,15 @@ public interface IDebugLoggerDriver : IDriver /// Outputs the text into the debugger file, and sets the time stamp. /// /// A sentence that will be written to the the debugger file. Supports {0}, {1}, ... - void Write(string text); + /// Debug level + void Write(string text, DebugLevel level); /// /// Outputs the text into the debugger file, and sets the time stamp. /// /// A sentence that will be written to the the debugger file. Supports {0}, {1}, ... + /// Debug level /// Variables to format the message before it's written. - void Write(string text, params object[] vars); + void Write(string text, DebugLevel level, params object[] vars); } } diff --git a/public/Nitrocid/Files/Paths/KernelPathType.cs b/public/Nitrocid/Files/Paths/KernelPathType.cs index 147d81bf1e..e669c8f879 100644 --- a/public/Nitrocid/Files/Paths/KernelPathType.cs +++ b/public/Nitrocid/Files/Paths/KernelPathType.cs @@ -33,10 +33,6 @@ public enum KernelPathType /// Configuration, /// - /// Kernel debug log file. - /// - Debugging, - /// /// Aliases file. /// Aliases, diff --git a/public/Nitrocid/Files/Paths/PathsManagement.cs b/public/Nitrocid/Files/Paths/PathsManagement.cs index 1e99b20df2..cd5ca83b14 100644 --- a/public/Nitrocid/Files/Paths/PathsManagement.cs +++ b/public/Nitrocid/Files/Paths/PathsManagement.cs @@ -41,7 +41,6 @@ public static class PathsManagement { $"{KernelPathType.Configuration}", (() => ConfigurationPath, true) }, { $"{KernelPathType.CustomLanguages}", (() => CustomLanguagesPath, true) }, { $"{KernelPathType.DebugDevices}", (() => DebugDevicesPath, true) }, - { $"{KernelPathType.Debugging}", (() => DebuggingPath, true) }, { $"{KernelPathType.Events}", (() => EventsPath, true) }, { $"{KernelPathType.SpeedDial}", (() => SpeedDialPath, true) }, { $"{KernelPathType.MAL}", (() => MALPath, true) }, @@ -143,12 +142,6 @@ public static string TempPath public static string ConfigurationPath => FilesystemTools.NeutralizePath(AppDataPath + "/KernelMainConfig.json"); - /// - /// Debugging path - /// - public static string DebuggingPath => - FilesystemTools.NeutralizePath(AppDataPath + "/kernelDbg.log"); - /// /// Aliases path /// diff --git a/public/Nitrocid/Kernel/Configuration/Instances/KernelMainConfig.cs b/public/Nitrocid/Kernel/Configuration/Instances/KernelMainConfig.cs index 32aece3444..ea2388c7e8 100644 --- a/public/Nitrocid/Kernel/Configuration/Instances/KernelMainConfig.cs +++ b/public/Nitrocid/Kernel/Configuration/Instances/KernelMainConfig.cs @@ -192,14 +192,6 @@ public double BlindnessSeverity /// public bool AllowUntrustedMods { get; set; } /// - /// Enables debug quota check - /// - public bool DebugQuotaCheck { get; set; } - /// - /// How many lines to print to the debug buffer before reaching the quota limit? - /// - public int DebugQuotaLines { get; set; } = 10000; - /// /// Whether to use the operating system time zone or to use the kernel-wide time zone /// public bool UseSystemTimeZone diff --git a/public/Nitrocid/Kernel/Debugging/DebugWriter.cs b/public/Nitrocid/Kernel/Debugging/DebugWriter.cs index 0374fee394..8e3cc34839 100644 --- a/public/Nitrocid/Kernel/Debugging/DebugWriter.cs +++ b/public/Nitrocid/Kernel/Debugging/DebugWriter.cs @@ -21,7 +21,12 @@ using System.Collections.Generic; using System.IO; using System.Text; +using Aptivestigate.Logging; +using Aptivestigate.Serilog; using Nitrocid.Drivers; +using Nitrocid.Files; +using Nitrocid.Files.Folders; +using Nitrocid.Files.Operations; using Nitrocid.Files.Operations.Querying; using Nitrocid.Files.Paths; using Nitrocid.Kernel.Configuration; @@ -31,6 +36,7 @@ using Nitrocid.Kernel.Exceptions; using Nitrocid.Kernel.Time; using Nitrocid.Kernel.Time.Renderers; +using Serilog; using Textify.General; namespace Nitrocid.Kernel.Debugging @@ -40,12 +46,8 @@ namespace Nitrocid.Kernel.Debugging /// public static class DebugWriter { - - internal static string DebugPath = ""; - internal static StreamWriter? DebugStreamWriter; - internal static bool isDisposed; + internal static BaseLogger? debugLogger; internal static object WriteLock = new(); - internal static int debugLines = 0; internal readonly static List debugStackTraces = []; /// @@ -113,20 +115,9 @@ public static void WriteDebugLogOnly(DebugLevel Level, string text, params objec { if (KernelEntry.DebugMode) { - // Open debugging stream - string debugFilePath = DebugPath; - if (DebugStreamWriter is null || DebugStreamWriter?.BaseStream is null || isDisposed) - { - DebugStreamWriter = new StreamWriter(debugFilePath, true) { AutoFlush = true }; - isDisposed = false; - } - // Try to debug... try { - // Check for quota - CheckDebugQuota(); - // Populate the debug stack frame var STrace = new DebugStackFrame(); StringBuilder message = new(); @@ -139,49 +130,30 @@ public static void WriteDebugLogOnly(DebugLevel Level, string text, params objec unwound++; } - // Remove the \r line endings from the text, since the debug file needs to have its line endings in the - // UNIX format anyways. - text = text.Replace(char.ToString((char)13), ""); - - // Handle the new lines - string[] texts = text.Split('\n'); - foreach (string splitText in texts) + // Handle new lines and write each line to the debugger + string result = + vars is not null && vars.Length > 0 ? + text.ToString().FormatString(vars) : + text.ToString(); + string[] split = result.SplitNewLines(); + foreach (string splitText in split) { - string routinePath = STrace.RoutinePath; - string date = TimeDateTools.KernelDateTime.ToShortDateString(); - string time = TimeDateTools.KernelDateTime.ToShortTimeString(); string routineName = STrace.RoutineName; string fileName = STrace.RoutineFileName; int fileLineNumber = STrace.RoutineLineNumber; // Check to see if source file name is not empty. - message.Append($"{date} {time} [{Level}] "); + message.Clear(); if (fileName is not null && fileLineNumber != 0) message.Append($"({routineName} - {fileName}:{fileLineNumber}): "); - message.Append($"{splitText}\n"); - } + message.Append($"{splitText}"); - // Debug to file and all connected debug devices (raw mode). The reason for the \r\n is that because - // Nitrocid on the Linux host tends to use \n only for new lines, and Windows considers \r\n as the - // new line. This causes the staircase effect on text written to the remote debugger, which messes up - // the output on Windows. - // - // However, we don't want to append the Windows new line character to the debug file, because we need - // it to have consistent line endings across platforms, like if you try to print the output of a text - // file that only has \n at the end of each line, we would inadvertently place the \r\n in each debug - // line, causing the file to have mixed line endings. - string result = - vars is not null && vars.Length > 0 ? - message.ToString().FormatString(vars) : - message.ToString(); - DriverHandler.CurrentDebugLoggerDriverLocal.Write(result); + // Write the result + DriverHandler.CurrentDebugLoggerDriverLocal.Write(message.ToString(), Level); #if VSDEBUG - Debug.Write(result); + Debug.Write($"[{Level}] {result}"); #endif - - // If quota is enabled, add the line count - if (Config.MainConfig.DebugQuotaCheck) - debugLines++; + } } catch (Exception ex) { @@ -358,28 +330,65 @@ public static void WriteDebugStackTrace(Exception? Ex) } internal static string GetExceptionTraceString(Exception ex) => - $"{ex.GetType().FullName}: {(ex is KernelException kex ? kex.OriginalExceptionMessage : ex.Message)}{CharManager.NewLine}{ex.StackTrace}{CharManager.NewLine}"; + $"{ex.GetType().FullName}: " + + $"{(ex is KernelException kex ? kex.OriginalExceptionMessage : ex.Message)}{CharManager.NewLine}" + + $"{ex.StackTrace}{CharManager.NewLine}"; + + internal static void InitializeDebug() => + InitializeDebug(LogTools.GenerateLogFilePath(out _)); - internal static void CheckDebugQuota() + internal static void InitializeDebug(string loggerPath) { - // Don't do anything if debug quota check is disabled. - if (!Config.MainConfig.DebugQuotaCheck) - return; + // Initialize debug logger + debugLogger = new SerilogLogger(new LoggerConfiguration().WriteTo.File(loggerPath, rollOnFileSizeLimit: true)); + } - // Now, check how many lines we've written to the buffer - if (debugLines > Config.MainConfig.DebugQuotaLines) + internal static void DeterministicDebug(string text, DebugLevel level, params object?[]? vars) + { + switch (level) { - debugLines = 0; - InitializeDebugPath(); - isDisposed = true; + case DebugLevel.T: + case DebugLevel.D: + if (vars is null) + debugLogger?.Debug($"[{level}] {text}"); + else + debugLogger?.Debug($"[{level}] {text}", vars); + break; + case DebugLevel.I: + if (vars is null) + debugLogger?.Info(text); + else + debugLogger?.Info(text, vars); + break; + case DebugLevel.W: + if (vars is null) + debugLogger?.Warning(text); + else + debugLogger?.Warning(text, vars); + break; + case DebugLevel.E: + if (vars is null) + debugLogger?.Error(text); + else + debugLogger?.Error(text, vars); + break; + case DebugLevel.F: + if (vars is null) + debugLogger?.Fatal(text); + else + debugLogger?.Fatal(text, vars); + break; } } - internal static void InitializeDebugPath() + internal static void RemoveDebugLogs() { - // Initialize debug path - DebugPath = Getting.GetNumberedFileName(Path.GetDirectoryName(PathsManagement.GetKernelPath(KernelPathType.Debugging)), PathsManagement.GetKernelPath(KernelPathType.Debugging)); + var files = Listing.GetFilesystemEntries(FilesystemTools.NeutralizePath(PathsManagement.AppDataPath + "/../Aptivi/Logs/") + "log_Nitrocid_*.txt"); + foreach (var file in files) + { + if (Checking.FileExists(file)) + Removing.RemoveFile(file); + } } - } } diff --git a/public/Nitrocid/Kernel/KernelMain.cs b/public/Nitrocid/Kernel/KernelMain.cs index bc862e9cf0..df61e6abfa 100644 --- a/public/Nitrocid/Kernel/KernelMain.cs +++ b/public/Nitrocid/Kernel/KernelMain.cs @@ -40,6 +40,7 @@ using Terminaux.Base.Extensions; using Nitrocid.Kernel.Configuration; using Terminaux.Writer.ConsoleWriters; +using Aptivestigate.CrashHandler; namespace Nitrocid.Kernel { @@ -90,6 +91,9 @@ internal static void Main(string[] Args) // Set main thread name Thread.CurrentThread.Name = "Main Nitrocid Kernel Thread"; + // Run unhandled crash handler + CrashTools.InstallCrashHandler(); + // Show help / version prior to starting the kernel if help / version is passed ArgumentParse.ParseArguments(Args, true); diff --git a/public/Nitrocid/Kernel/Starting/KernelInitializers.cs b/public/Nitrocid/Kernel/Starting/KernelInitializers.cs index 75e0d290f9..bc6dc16d31 100644 --- a/public/Nitrocid/Kernel/Starting/KernelInitializers.cs +++ b/public/Nitrocid/Kernel/Starting/KernelInitializers.cs @@ -96,8 +96,8 @@ internal static void InitializeCritical() if (Listing.GetFilesystemEntries(PathsManagement.AppDataPath).Length == 0) KernelEntry.FirstTime = true; - // Initialize debug path - DebugWriter.InitializeDebugPath(); + // Initialize debug + DebugWriter.InitializeDebug(); // Power signal handlers PowerSignalHandlers.RegisterHandlers(); @@ -754,10 +754,6 @@ internal static void ResetEverything() { DebugWriter.WriteDebug(DebugLevel.I, "Shutting down debugger"); KernelEntry.DebugMode = false; - DebugWriter.DebugStreamWriter?.Close(); - DebugWriter.DebugStreamWriter?.Dispose(); - DebugWriter.isDisposed = true; - DebugWriter.debugLines = 0; } catch (Exception exc) { diff --git a/public/Nitrocid/Nitrocid.csproj b/public/Nitrocid/Nitrocid.csproj index db0a646148..156321cf10 100644 --- a/public/Nitrocid/Nitrocid.csproj +++ b/public/Nitrocid/Nitrocid.csproj @@ -41,9 +41,11 @@ + + diff --git a/public/Nitrocid/Resources/Settings/SettingsEntries.json b/public/Nitrocid/Resources/Settings/SettingsEntries.json index ac8a19c7bc..d8551dec6d 100644 --- a/public/Nitrocid/Resources/Settings/SettingsEntries.json +++ b/public/Nitrocid/Resources/Settings/SettingsEntries.json @@ -173,18 +173,6 @@ "Variable": "AllowUntrustedMods", "Description": "If set to true, the kernel won't error out upon loading mods that don't have the signed public key." }, - { - "Name": "Debug quota enabled", - "Type": "SBoolean", - "Variable": "DebugQuotaCheck", - "Description": "If this option is enabled, the debug writer rotates the debug log file if the quota is exceeded." - }, - { - "Name": "Debug quota line count", - "Type": "SInt", - "Variable": "DebugQuotaLines", - "Description": "How many lines to print to the debug buffer before reaching the quota limit? Please note that it doesn't represent how many lines are in the debug log files." - }, { "Name": "Use system time zone", "Type": "SBoolean", diff --git a/public/Nitrocid/Shell/Shells/Admin/Commands/CdbgLog.cs b/public/Nitrocid/Shell/Shells/Admin/Commands/CdbgLog.cs index 8908c3aa24..f9d88241ef 100644 --- a/public/Nitrocid/Shell/Shells/Admin/Commands/CdbgLog.cs +++ b/public/Nitrocid/Shell/Shells/Admin/Commands/CdbgLog.cs @@ -18,11 +18,9 @@ // using System; -using System.IO; using Nitrocid.ConsoleBase.Colors; using Nitrocid.ConsoleBase.Writers; using Terminaux.Writer.ConsoleWriters; -using Nitrocid.Files.Paths; using Nitrocid.Kernel; using Nitrocid.Kernel.Debugging; using Nitrocid.Kernel.Exceptions; @@ -46,8 +44,7 @@ public override int Execute(CommandParameters parameters, ref string variableVal { try { - DebugWriter.DebugStreamWriter?.Close(); - DebugWriter.DebugStreamWriter = new StreamWriter(PathsManagement.GetKernelPath(KernelPathType.Debugging)) { AutoFlush = true }; + DebugWriter.RemoveDebugLogs(); TextWriterColor.Write(Translate.DoTranslation("Debug log removed. All connected debugging devices may still view messages.")); return 0; } diff --git a/public/Nitrocid/Shell/Shells/Debug/Commands/DebugLog.cs b/public/Nitrocid/Shell/Shells/Debug/Commands/DebugLog.cs index 35a3bf176d..05ab14ae72 100644 --- a/public/Nitrocid/Shell/Shells/Debug/Commands/DebugLog.cs +++ b/public/Nitrocid/Shell/Shells/Debug/Commands/DebugLog.cs @@ -26,6 +26,8 @@ using Nitrocid.Files.Paths; using Nitrocid.ConsoleBase.Colors; using Terminaux.Writer.ConsoleWriters; +using Nitrocid.Files; +using System; namespace Nitrocid.Shell.Shells.Debug.Commands { @@ -40,19 +42,17 @@ class DebugLogCommand : BaseCommand, ICommand public override int Execute(CommandParameters parameters, ref string variableValue) { - // Try to parse the session number. - string sessionNumStr = parameters.ArgumentsList[0]; - if (!int.TryParse(sessionNumStr, out int sessionNum)) + // Try to parse the session GUID. + string sessionGuidStr = parameters.ArgumentsList[0]; + if (!Guid.TryParse(sessionGuidStr, out Guid sessionGuid)) { - // There is invalid session number being requested - TextWriters.Write(Translate.DoTranslation("Invalid session number") + $" {sessionNumStr}", true, KernelColorType.Error); + // There is invalid session GUID being requested + TextWriters.Write(Translate.DoTranslation("Invalid session GUID") + $" {sessionGuidStr}", true, KernelColorType.Error); return KernelExceptionTools.GetErrorCode(KernelExceptionType.Debug); } - // Now, check to see if we have this session number. Get all the debug logs and compare. - string TargetPath = PathsManagement.GetKernelPath(KernelPathType.Debugging); - TargetPath = TargetPath[..TargetPath.LastIndexOf(".log")] + "*.log"; - string[] debugs = Listing.GetFilesystemEntries(TargetPath); + // Now, check to see if we have this session GUID. Get all the debug logs and compare. + var debugs = Listing.GetFilesystemEntries(FilesystemTools.NeutralizePath(PathsManagement.AppDataPath + "/../Aptivi/Logs/") + "log_Nitrocid_*.txt"); string finalDebug = ""; foreach (string debug in debugs) { @@ -60,16 +60,16 @@ public override int Execute(CommandParameters parameters, ref string variableVal if (!string.IsNullOrEmpty(finalDebug)) break; - // Check the debug path and compare it with the requested session number. - if (debug.Contains($"kernelDbg-{sessionNum}.log")) + // Check the debug path and compare it with the requested session GUID. + if (debug.Contains($"{sessionGuid}")) finalDebug = debug; } // Check to see if we really have the file path if (string.IsNullOrEmpty(finalDebug)) { - // There is no such session number being requested - TextWriters.Write(Translate.DoTranslation("No such session number") + $" {sessionNumStr}", true, KernelColorType.Error); + // There is no such session GUID being requested + TextWriters.Write(Translate.DoTranslation("No such session GUID") + $" {sessionGuidStr}", true, KernelColorType.Error); return KernelExceptionTools.GetErrorCode(KernelExceptionType.Debug); } diff --git a/public/Nitrocid/Shell/Shells/Debug/DebugShellInfo.cs b/public/Nitrocid/Shell/Shells/Debug/DebugShellInfo.cs index 3fd144ea90..d0e94b8196 100644 --- a/public/Nitrocid/Shell/Shells/Debug/DebugShellInfo.cs +++ b/public/Nitrocid/Shell/Shells/Debug/DebugShellInfo.cs @@ -50,10 +50,7 @@ internal class DebugShellInfo : BaseShellInfo, IShellInfo [ new CommandArgumentInfo(new[] { - new CommandArgumentPart(true, "sessionNum", new CommandArgumentPartOptions() - { - IsNumeric = true - }) + new CommandArgumentPart(true, "sessionGuid") }) ], new DebugLogCommand(), CommandFlags.Wrappable | CommandFlags.RedirectionSupported),