{"id":13466551,"url":"https://github.com/BlazorExtensions/Logging","last_synced_at":"2025-03-25T21:32:29.848Z","repository":{"id":32305957,"uuid":"132212109","full_name":"BlazorExtensions/Logging","owner":"BlazorExtensions","description":"Microsoft Extension Logging implementation for Blazor","archived":false,"fork":false,"pushed_at":"2024-07-09T21:23:54.000Z","size":511,"stargazers_count":216,"open_issues_count":4,"forks_count":32,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-19T11:16:45.995Z","etag":null,"topics":["blazor","logging","logging-library","microsoft-extensions-logging","wasm","web-assembly","webassembly"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlazorExtensions.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}},"created_at":"2018-05-05T03:43:18.000Z","updated_at":"2025-02-23T00:06:50.000Z","dependencies_parsed_at":"2024-07-31T15:13:21.588Z","dependency_job_id":null,"html_url":"https://github.com/BlazorExtensions/Logging","commit_stats":{"total_commits":60,"total_committers":9,"mean_commits":6.666666666666667,"dds":0.5833333333333333,"last_synced_commit":"b2ec1846f542e676895a0febbbcfaa4494f070a6"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlazorExtensions%2FLogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlazorExtensions%2FLogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlazorExtensions%2FLogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlazorExtensions%2FLogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlazorExtensions","download_url":"https://codeload.github.com/BlazorExtensions/Logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245548561,"owners_count":20633611,"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","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":["blazor","logging","logging-library","microsoft-extensions-logging","wasm","web-assembly","webassembly"],"created_at":"2024-07-31T15:00:46.099Z","updated_at":"2025-03-25T21:32:29.473Z","avatar_url":"https://github.com/BlazorExtensions.png","language":"C#","funding_links":[],"categories":["Libraries \u0026 Extensions"],"sub_categories":["Tools \u0026 Utilities"],"readme":"[![Build](https://github.com/BlazorExtensions/Logging/workflows/CI/badge.svg)](https://github.com/BlazorExtensions/Logging/actions)\r\n[![Package Version](https://img.shields.io/nuget/v/Blazor.Extensions.Logging.svg)](https://www.nuget.org/packages/Blazor.Extensions.Logging)\r\n[![NuGet Downloads](https://img.shields.io/nuget/dt/Blazor.Extensions.Logging.svg)](https://www.nuget.org/packages/Blazor.Extensions.Logging)\r\n[![License](https://img.shields.io/github/license/BlazorExtensions/Logging.svg)](https://github.com/BlazorExtensions/Logging/blob/master/LICENSE)\r\n\r\n# Blazor Extensions\r\n\r\nBlazor Extensions is a set of packages with the goal of adding useful features to [Blazor](https://blazor.net).\r\n\r\n# Blazor Extensions Logging\r\n\r\nThis package is an implementation for the [Microsoft Extensions Logging](https://github.com/aspnet/Logging) abstraction to support\r\nusing the ```ILogger``` interface in your Blazor code.\r\n\r\nWhen the component is configured, all the log statements will appear in the browser's developer tools console.\r\n\r\n# Features\r\n\r\n## Content to log\r\n\r\nThe logger supports the same string formatting that MEL provides, together with named parameter replacement in the message.\r\n\r\nAdditionaly, you're able to log an object in the browser console. You can expand members and hierachies to see what's contained within.\r\n\r\nIf you want to log an enumerable list of objects, then the browser side component will display it by calling ```console.table```.\r\n\r\n## Filtering\r\n\r\nThe implementation supports the ```ILoggerFactory```-based filtering configuration that is supplied by the Microsoft Extension Logging abstraction.\r\n\r\nTo keep it lightweight, [Microsoft Extensions Configuration](https://github.com/aspnet/Configuration) based configuration is not supported; the logger can be only configured in code.\r\n\r\n## Log levels\r\n\r\nThe logger supports the [LogLevels](https://github.com/aspnet/Logging/blob/master/src/Microsoft.Extensions.Logging.Abstractions/LogLevel.cs) defined in MEL.\r\n\r\nSome of the log levels are not available as distinct methods in the browser's developer tool, so the browser side component does some [mapping](https://github.com/BlazorExtensions/Logging/blob/master/src/Blazor.Extensions.Logging.JS/src/BrowserConsoleLogger.ts#L13).\r\n\r\n# Sample configuration\r\n\r\n## Setup\r\n\r\nThe following snippet shows how to setup the browser console logger by registering it for dependency injection in the ```Program.cs``` of the application.\r\n\r\n```c#\r\n// Add Blazor.Extensions.Logging.BrowserConsoleLogger\r\nbuilder.Services.AddLogging(builder =\u003e builder\r\n    .AddBrowserConsole()\r\n    .SetMinimumLevel(LogLevel.Trace)\r\n);\r\n```\r\n\r\n## Usage\r\n\r\nThe following snippet shows how to consume the logger in a Blazor component.\r\n\r\n```c#\r\n@inject ILogger\u003cIndex\u003e logger\r\n\r\n@functions {\r\n  protected override async Task OnInitializedAsync()\r\n  {\r\n      logger.LogDebug(\"MyComponent init\");\r\n  }\r\n}\r\n```\r\n\r\nIf you want to consume it outside of a ```cshtml``` based component, then you can use the ```Inject``` attribute to inject it into the class.\r\n\r\n```c#\r\n[Inject]\r\nprotected ILogger\u003cMyClass\u003e Logger {get;set;}\r\n\r\npublic void LogSomething()\r\n{\r\n  Logger.LogDebug(\"Inside LogSomething\");\r\n}\r\n```\r\n\r\n# Contributions and feedback\r\n\r\nPlease feel free to use the component, open issues, fix bugs or provide feedback.\r\n\r\n# Contributors\r\n\r\nThe following people are the maintainers of the Blazor Extensions projects:\r\n\r\n- [Attila Hajdrik](https://github.com/attilah)\r\n- [Gutemberg Ribiero](https://github.com/galvesribeiro)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlazorExtensions%2FLogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBlazorExtensions%2FLogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlazorExtensions%2FLogging/lists"}