diff --git a/src/Core/src/Hosting/Internal/FallbackLogging.Debug.cs b/src/Core/src/Hosting/Internal/FallbackLogging.Debug.cs new file mode 100644 index 000000000000..2b3d286981ba --- /dev/null +++ b/src/Core/src/Hosting/Internal/FallbackLogging.Debug.cs @@ -0,0 +1,19 @@ +#nullable enable +#define DEBUG + +using System.Diagnostics; +using Microsoft.Extensions.Logging; + +namespace Microsoft.Maui.Hosting.Internal +{ + partial class FallbackLoggerFactory + { + partial class FallbackLogger : ILogger + { + void DebugWriteLine(string message) + { + Debug.WriteLine(message, category: _categoryName); + } + } + } +} \ No newline at end of file diff --git a/src/Core/src/Hosting/Internal/FallbackLogging.cs b/src/Core/src/Hosting/Internal/FallbackLogging.cs index 99b3f33abeff..c836fbe08bbe 100644 --- a/src/Core/src/Hosting/Internal/FallbackLogging.cs +++ b/src/Core/src/Hosting/Internal/FallbackLogging.cs @@ -6,7 +6,7 @@ namespace Microsoft.Maui.Hosting.Internal { - class FallbackLoggerFactory : ILoggerFactory + partial class FallbackLoggerFactory : ILoggerFactory { public void AddProvider(ILoggerProvider provider) { } @@ -15,7 +15,7 @@ public ILogger CreateLogger(string categoryName) => public void Dispose() { } - class FallbackLogger : ILogger + partial class FallbackLogger : ILogger { private string _categoryName; @@ -46,7 +46,7 @@ public void Log(LogLevel logLevel, EventId eventId, TState state, Except if (exception != null) message += Environment.NewLine + Environment.NewLine + exception; - Debug.WriteLine(message, category: _categoryName); + DebugWriteLine(message); } }