A console sink for the Blazor/Wasm environment.
What's it do?
The sink writes log events to the browser console. Unlike the normal Serilog console sink, which writes out formatted text, this sink takes advantage of the unique capabilities of the browser console to print interactive, fully-structured data.
The sink is compatible with .NET Standard 2.0 and is built against Blazor 0.6.
Configure the logging pipeline in
// dotnet add package Serilog.Sinks.BrowserConsole -v ... Log.Logger = new LoggerConfiguration() .WriteTo.BrowserConsole() .CreateLogger(); Log.Information("Hello, browser!");
A more detailed example is available in this repository.