From ba0f5d7a317bf0f679760ebd920f37e76ba83436 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 17 Aug 2025 07:23:31 +0100 Subject: [PATCH] All messages written to AnsiConsole shall go as informational messages to Serilog. --- Aaru/Main.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Aaru/Main.cs b/Aaru/Main.cs index 607517662..e84410739 100644 --- a/Aaru/Main.cs +++ b/Aaru/Main.cs @@ -92,6 +92,11 @@ class MainClass AnsiConsole.MarkupLine(format); else AnsiConsole.MarkupLine(format, objects); + + // Format the string so we can remove the markup + string formatted = objects is null ? format : string.Format(format, objects); + formatted = Markup.Remove(formatted); + Log.Information(formatted); }; AaruLogging.WriteEvent += (format, objects) => @@ -100,6 +105,11 @@ class MainClass AnsiConsole.Markup(format); else AnsiConsole.Markup(format, objects); + + // Format the string so we can remove the markup + string formatted = objects is null ? format : string.Format(format, objects); + formatted = Markup.Remove(formatted); + Log.Information(formatted); }; AaruLogging.ErrorEvent += Log.Error; @@ -411,8 +421,10 @@ class MainClass AnsiConsole.MarkupLine("[bold][blue]{0}[/][/]", _assemblyCopyright); AnsiConsole.WriteLine(); - AaruLogging.Information("Aaru Data Preservation Suite {InformationalVersion}", _assemblyVersion?.InformationalVersion); - AaruLogging.Information("{AssemblyCopyright}", _assemblyCopyright); + AaruLogging.Information("Aaru Data Preservation Suite {InformationalVersion}", + _assemblyVersion?.InformationalVersion); + + AaruLogging.Information("{AssemblyCopyright}", _assemblyCopyright); AaruLogging.Information("Logging started"); } } \ No newline at end of file