{"id":23451285,"url":"https://github.com/nlog/nlog.targets.mauilog","last_synced_at":"2025-07-22T20:06:19.996Z","repository":{"id":65498185,"uuid":"530082818","full_name":"NLog/NLog.Targets.MauiLog","owner":"NLog","description":"NLog MauiLog Target for writing to Apple Unified Logging OSLog / Android.Util.Log for LogCat ","archived":false,"fork":false,"pushed_at":"2025-07-20T19:57:51.000Z","size":211,"stargazers_count":21,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-20T21:25:31.804Z","etag":null,"topics":["aot","aot-compilation","csharp","dotnet","logcat","logging","logging-library","maui","netstandard","nlog","nlog-target","nslog","oslog","xamarin","xamarin-android","xamarin-ios"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NLog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-29T05:48:32.000Z","updated_at":"2025-07-20T18:34:36.000Z","dependencies_parsed_at":"2023-10-15T11:18:18.989Z","dependency_job_id":"1ab5064b-8318-461e-972a-e4e20d42d44f","html_url":"https://github.com/NLog/NLog.Targets.MauiLog","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/NLog/NLog.Targets.MauiLog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.Targets.MauiLog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.Targets.MauiLog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.Targets.MauiLog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.Targets.MauiLog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NLog","download_url":"https://codeload.github.com/NLog/NLog.Targets.MauiLog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NLog%2FNLog.Targets.MauiLog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266563915,"owners_count":23948689,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aot","aot-compilation","csharp","dotnet","logcat","logging","logging-library","maui","netstandard","nlog","nlog-target","nslog","oslog","xamarin","xamarin-android","xamarin-ios"],"created_at":"2024-12-24T00:25:35.475Z","updated_at":"2025-07-22T20:06:19.988Z","avatar_url":"https://github.com/NLog.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NLog.Targets.MauiLog\nNLog Target for debugging on MAUI / Xamarin Mobile Platforms:\n\n- Apple iOS / MacOS - Unified Logging OSLog (replacement of print and NSLog) \n- Android - Android.Util.Log / LogCat\n- NetStandard - System.Diagnostics.Debugger.Log\n\n[![Version](https://badge.fury.io/nu/NLog.Targets.MauiLog.svg)](https://www.nuget.org/packages/NLog.Targets.MauiLog)\n[![AppVeyor](https://img.shields.io/appveyor/ci/nlog/nlog-targets-mauilog/master.svg)](https://ci.appveyor.com/project/nlog/nlog-targets-mauilog/branch/master)\n\n## How to setup NLog in MAUI\n\n1) **Install the NLog packages**\n\n   - `Install-Package NLog.Targets.MauiLog` \n   - `Install-Package NLog.Extensions.Logging` \n    \n   or in your csproj (Use ver. 8 for NET8, and ver. 7 for NET7 etc.):\n\n    ```xml\n    \u003cPackageReference Include=\"NLog.Targets.MauiLog\" Version=\"8.*\" /\u003e\n    \u003cPackageReference Include=\"NLog.Extensions.Logging\" Version=\"6.*\" /\u003e\n    ```\n\n2) **Add NLog to the MauiApp**\n\n   Update `MauiProgram.cs` to include NLog as Logging Provider: \n   ```csharp\n   var builder = MauiApp.CreateBuilder();\n\n   // Add NLog for Logging\n   builder.Logging.ClearProviders();\n   builder.Logging.AddNLog();\n   ```\n\n   If getting compiler errors with unknown methods, then update `using`-section:\n   ```csharp\n   using Microsoft.Extensions.Logging;\n   using NLog;\n   using NLog.Extensions.Logging;\n   ```\n\n3) **Load NLog configuration for logging**\n\n   Add the `NLog.config`-file into the Application-project as assembly-resource (`Build Action` = `embedded resource`), and load like this:\n   ```csharp\n   NLog.LogManager.Setup().RegisterMauiLog()\n       .LoadConfigurationFromAssemblyResource(typeof(App).Assembly);\n   ```\n   Alternative setup NLog configuration using [fluent-API](https://github.com/NLog/NLog/wiki/Fluent-Configuration-API):\n   ```csharp\n   var logger = NLog.LogManager.Setup().RegisterMauiLog()\n                    .LoadConfiguration(c =\u003e c.ForLogger().FilterMinLevel(NLog.LogLevel.Debug).WriteToMauiLog())\n                    .GetCurrentClassLogger();\n   ```\n\n## Configuration options for MAUI Log Target\n\n- **Layout** - LogEvent message layout\n- **Category** - LogEvent category layout (optional)\n\nExample `NLog.config`-file:\n\n```xml\n\u003cnlog\u003e\n\u003cextensions\u003e\n    \u003cadd assembly=\"NLog.Targets.MauiLog\" /\u003e\n\u003c/extensions\u003e\n\u003ctargets\u003e\n    \u003ctarget name=\"mauilog\" type=\"MauiLog\" /\u003e\n\u003c/targets\u003e\n\u003crules\u003e\n    \u003clogger name=\"*\" minLevel=\"Info\" writeTo=\"mauilog\" /\u003e\n\u003c/rules\u003e\n\u003c/nlog\u003e\n```\n\nSee also [Logging Unhandled Exceptions](https://github.com/NLog/NLog.Targets.MauiLog/wiki/Logging-Unhandled-Exceptions)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlog%2Fnlog.targets.mauilog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnlog%2Fnlog.targets.mauilog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnlog%2Fnlog.targets.mauilog/lists"}