refactor: replace Console.WriteLine with DiagnosticLog service
All checks were successful
CI / Build (Linux) (push) Successful in 21s

Replace 495+ Console.WriteLine debug statements across handlers, dispatching, services, views, and window components with centralized DiagnosticLog service for proper logging infrastructure. Add new DiagnosticLog.cs service with Debug/Error methods to eliminate debug logging pollution in production code.
This commit is contained in:
2026-03-06 22:06:08 -05:00
parent 08e0c4d2b9
commit e55230c441
70 changed files with 814 additions and 638 deletions

View File

@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.Maui.Platform.Linux.Interop;
using Microsoft.Maui.Platform.Linux.Services;
using SkiaSharp;
namespace Microsoft.Maui.Platform;
@@ -111,7 +112,7 @@ public class LinuxWebView : SkiaView
_gtkWindow = WebKitGtk.gtk_window_new(0);
if (_gtkWindow == IntPtr.Zero)
{
Console.WriteLine("[LinuxWebView] Failed to create GTK window");
DiagnosticLog.Error("LinuxWebView", "Failed to create GTK window");
return;
}
@@ -123,7 +124,7 @@ public class LinuxWebView : SkiaView
_webView = WebKitGtk.webkit_web_view_new();
if (_webView == IntPtr.Zero)
{
Console.WriteLine("[LinuxWebView] Failed to create WebKit WebView");
DiagnosticLog.Error("LinuxWebView", "Failed to create WebKit WebView");
WebKitGtk.gtk_widget_destroy(_gtkWindow);
_gtkWindow = IntPtr.Zero;
return;
@@ -148,12 +149,12 @@ public class LinuxWebView : SkiaView
WebKitGtk.gtk_container_add(_gtkWindow, _webView);
_initialized = true;
Console.WriteLine("[LinuxWebView] WebKitGTK WebView initialized successfully");
DiagnosticLog.Debug("LinuxWebView", "WebKitGTK WebView initialized successfully");
}
catch (Exception ex)
{
Console.WriteLine($"[LinuxWebView] Initialization failed: {ex.Message}");
Console.WriteLine($"[LinuxWebView] Make sure WebKitGTK is installed: sudo apt install libwebkit2gtk-4.1-0");
DiagnosticLog.Error("LinuxWebView", $"Initialization failed: {ex.Message}", ex);
DiagnosticLog.Warn("LinuxWebView", "Make sure WebKitGTK is installed: sudo apt install libwebkit2gtk-4.1-0");
}
}