Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/serilog/serilog-sinks-browserconsole
A console sink for the Blazor/Wasm environment
https://github.com/serilog/serilog-sinks-browserconsole
blazor logging serilog
Last synced: 4 days ago
JSON representation
A console sink for the Blazor/Wasm environment
- Host: GitHub
- URL: https://github.com/serilog/serilog-sinks-browserconsole
- Owner: serilog
- License: apache-2.0
- Created: 2018-10-07T10:10:20.000Z (about 6 years ago)
- Default Branch: dev
- Last Pushed: 2024-07-12T05:26:07.000Z (5 months ago)
- Last Synced: 2024-12-09T09:54:40.674Z (13 days ago)
- Topics: blazor, logging, serilog
- Language: C#
- Homepage:
- Size: 441 KB
- Stars: 62
- Watchers: 14
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serilog.Sinks.BrowserConsole [![Build status](https://ci.appveyor.com/api/projects/status/s458q719m2pfwnyk?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-browserconsole) [![NuGet Pre Release](https://img.shields.io/nuget/vpre/Serilog.Sinks.BrowserConsole.svg)](https://nuget.org/packages/Serilog.Sinks.BrowserConsole)
A Serilog sink that takes advantage of the unique features of the browser console in the Blazor/WASM applications.
**Versioning:** This package tracks the versioning and target framework support of its _Microsoft.AspNetCore.Components.WebAssembly_ dependency. Most users should choose the version of _Serilog.Sinks.BrowserConsole_ that matches their application's target framework. I.e. if you're targeting .NET 7.x, choose a 7.x version of _Serilog.Sinks.BrowserConsole_. If you're targeting .NET 8.x, choose an 8.x _Serilog.Sinks.BrowserConsole_ version, and so on.
### 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.
![Serilog.Sinks.BrowserConsole](https://raw.githubusercontent.com/serilog/serilog-sinks-browserconsole/dev/assets/Screenshot.png)
### Getting started
Configure the logging pipeline in `Program.Main()`:
```csharp
// dotnet add package Serilog.Sinks.BrowserConsoleLog.Logger = new LoggerConfiguration()
.WriteTo.BrowserConsole()
.CreateLogger();Log.Information("Hello, browser!");
```A more detailed example is available [in this repository](https://github.com/serilog/serilog-sinks-browserconsole/tree/dev/example/ExampleClient).