@page "/serilog-demo" @inject ILogger Logger @inject IJSRuntime JSRuntime

Serilog Logging Infrastructure

Production-grade diagnostic pipeline for unified native & web logs

Pipeline Active

Native .NET Logs (C#)

Trigger structured C# logs using Dependency Injected ILogger.

Blazor / JS WebView Logs

Trigger logs from JavaScript to verify the interop error capture bridge.

Pipeline Diagnostics

Rolling Daily File Sandbox Path AppDataDirectory/logs/log-*.txt
Active Configuration Provider Serilog.Settings.Configuration (appsettings.json)
Native Apple Console Sink Serilog.Sinks.Debug (conditional compilation)
Native Android Logcat Sink AndroidLogcatSink (direct JNI bindings)
@code { private void LogInfo() { Logger.LogInformation("Structured native log triggered by user from SerilogDemo. Button: LogInfo"); } private void LogWarning() { Logger.LogWarning("Potential warning log triggered from Blazor razor component at {Time}", DateTime.UtcNow); } private void LogError() { try { throw new InvalidOperationException("Simulated native C# operation exception triggered in Diagnostic dashboard."); } catch (Exception ex) { Logger.LogError(ex, "Captured exception successfully in native Serilog pipeline!"); } } private async Task TriggerJsLog() { await JSRuntime.InvokeVoidAsync("console.log", "Intercepted JS console statement from Blazor WebView interop trigger!"); } private async Task TriggerJsException() { await JSRuntime.InvokeVoidAsync("eval", "throw new Error('Simulated runtime JS Exception triggered from Blazor UI button click!');"); } }