Majorsoft.Blazor.WebAssembly.Logging.Console 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Majorsoft.Blazor.WebAssembly.Logging.Console --version 1.0.0                
NuGet\Install-Package Majorsoft.Blazor.WebAssembly.Logging.Console -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Majorsoft.Blazor.WebAssembly.Logging.Console" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Majorsoft.Blazor.WebAssembly.Logging.Console --version 1.0.0                
#r "nuget: Majorsoft.Blazor.WebAssembly.Logging.Console, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Majorsoft.Blazor.WebAssembly.Logging.Console as a Cake Addin
#addin nuget:?package=Majorsoft.Blazor.WebAssembly.Logging.Console&version=1.0.0

// Install Majorsoft.Blazor.WebAssembly.Logging.Console as a Cake Tool
#tool nuget:?package=Majorsoft.Blazor.WebAssembly.Logging.Console&version=1.0.0                

Blazor WebAssembly Hosted model console logging

Build Status Package Version NuGet Downloads License

About

Blazor extension for logging to browser console. Important NOTE: this package only works for apps using WebAssemly Hosting Model!

You can try it out by using the demo app.

Features

Logger

This package implements Microsoft Extensions Logging abstraction to support using of ILogger and ILogger<T> interface for WebAssemly Blazor Console logging.

When this package installed and configured all logs written by ILogger and ILogger<T> will reach Browser console logger and log messages will appear in the browser's developer tools Console tab.

Log levels

The logger supports the LogLevels defined by Microsoft LogLevel enum.

Configuration

Installation

Blazor.Components.Deboudnce.Input is available on NuGet.

dotnet add package Majorsoft.Blazor.WebAssembly.Logging.Console

Use the --version option to specify a preview version to install.

Setup

Add the following code snippet to your WebAssembly hosted (client side) Blazor Application. Into the **Program.cs** file 'Main' method.

using Blazor.WebAssembly.Logging.Console;

...

builder.Logging.AddBrowserConsole()
	.SetMinimumLevel(LogLevel.Debug) //Setting LogLevel is optional
	.AddFilter("Microsoft", LogLevel.Information); //System logs can be filtered.

Usage

After setup usage is very simple. Just use by standard logging with injected ILogger object. The following code snippet shows how to use logger in a Blazor component.

@using Microsoft.Extensions.Logging

@inject ILogger<Index> _logger
@code {
	protected override void OnInitialized()
	{
		_logger.LogDebug("Index init");
	}
}

The following code snippet shows how to use logger in .cs files.

using Microsoft.Extensions.Logging;

...

public class CustomCode
{
	private readonly ILogger<CustomCode> _logger;
	public CustomCode(ILogger<CustomCode> logger)
	{
		_logger = logger;
		_logger.LogDebug("CustomCode init");
	}
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Majorsoft.Blazor.WebAssembly.Logging.Console:

Repository Stars
majorimi/blazor-components
Components collection and extensions for Blazor applications.
Version Downloads Last updated
1.5.0 41,962 8/27/2021
1.4.0 1,286 7/15/2021
1.3.0 701 3/10/2021
1.2.0 1,525 1/5/2021
1.1.0 447 12/18/2020
1.0.1 471 11/30/2020
1.0.0 470 11/11/2020
0.9.52-rc.2.20479.15 282 10/30/2020
0.9.50-rc.2.20479.15 243 10/27/2020