NLog Target for debugging on MAUI / Xamarin Mobile Platforms:
- Apple iOS / MacOS - Unified Logging OSLog (replacement of print and NSLog)
- Android - Android.Util.Log / LogCat
- NetStandard - System.Diagnostics.Debugger.Log
-
Install the package
Install-Package NLog.Targets.MauiLog
or in your csproj:<PackageReference Include="NLog.Targets.MauiLog" Version="1.*" />
-
Add to your nlog.config:
<extensions> <add assembly="NLog.Targets.MauiLog"/> </extensions>
-
Use the target "mauilog" in your nlog.config
<targets> <target name="mauilog" type="MauiLog" /> </targets> <rules> <logger minLevel="Info" writeTo="mauilog" /> </rules>
- Layout - LogEvent message layout
- Category - LogEvent category layout (optional)