feat(infra): Docker-compose configuration and environment-specific security guards for Beta deployment to Test environment #56
@@ -2,116 +2,128 @@
|
|||||||
@inject ILogger<SerilogDemo> Logger
|
@inject ILogger<SerilogDemo> Logger
|
||||||
@inject IJSRuntime JSRuntime
|
@inject IJSRuntime JSRuntime
|
||||||
|
|
||||||
#if DEBUG
|
@if (_isDebug)
|
||||||
<div class="serilog-demo-container">
|
{
|
||||||
<div class="header-card glass-panel">
|
<div class="serilog-demo-container">
|
||||||
<div class="header-content">
|
<div class="header-card glass-panel">
|
||||||
<NexusIcon Name="cpu" Size="36" Class="header-icon" />
|
<div class="header-content">
|
||||||
<div class="header-text">
|
<NexusIcon Name="cpu" Size="36" Class="header-icon" />
|
||||||
<h1>Serilog Logging Infrastructure</h1>
|
<div class="header-text">
|
||||||
<p class="subtitle">Production-grade diagnostic pipeline for unified native & web logs</p>
|
<h1>Serilog Logging Infrastructure</h1>
|
||||||
|
<p class="subtitle">Production-grade diagnostic pipeline for unified native & web logs</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="status-badge">
|
||||||
|
<span class="status-dot green"></span>
|
||||||
|
<span class="status-text">Pipeline Active</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="status-badge">
|
|
||||||
<span class="status-dot green"></span>
|
|
||||||
<span class="status-text">Pipeline Active</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="demo-grid">
|
<div class="demo-grid">
|
||||||
<!-- Native .NET Logging Panel -->
|
<!-- Native .NET Logging Panel -->
|
||||||
<div class="control-card glass-panel">
|
<div class="control-card glass-panel">
|
||||||
|
<div class="card-header">
|
||||||
|
<NexusIcon Name="terminal" Size="20" Class="card-icon" />
|
||||||
|
<h2>Native .NET Logs (C#)</h2>
|
||||||
|
</div>
|
||||||
|
<p class="card-desc">Trigger structured C# logs using Dependency Injected ILogger.</p>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-info" @onclick="LogInfo">
|
||||||
|
<NexusIcon Name="info" Size="16" />
|
||||||
|
Log Info
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-warning" @onclick="LogWarning">
|
||||||
|
<NexusIcon Name="alert-triangle" Size="16" />
|
||||||
|
Log Warning
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-error" @onclick="LogError">
|
||||||
|
<NexusIcon Name="x-circle" Size="16" />
|
||||||
|
Log Error Exception
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Blazor / JS Interop Bridge Panel -->
|
||||||
|
<div class="control-card glass-panel">
|
||||||
|
<div class="card-header">
|
||||||
|
<NexusIcon Name="globe" Size="20" Class="card-icon js-icon" />
|
||||||
|
<h2>Blazor / JS WebView Logs</h2>
|
||||||
|
</div>
|
||||||
|
<p class="card-desc">Trigger logs from JavaScript to verify the interop error capture bridge.</p>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-js-info" @onclick="TriggerJsLog">
|
||||||
|
<NexusIcon Name="message-square" Size="16" />
|
||||||
|
Trigger console.log()
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-js-error" @onclick="TriggerJsException">
|
||||||
|
<NexusIcon Name="zap" Size="16" />
|
||||||
|
Trigger JS Exception
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Active Log Config Panel -->
|
||||||
|
<div class="config-card glass-panel">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<NexusIcon Name="terminal" Size="20" Class="card-icon" />
|
<NexusIcon Name="settings" Size="20" Class="card-icon" />
|
||||||
<h2>Native .NET Logs (C#)</h2>
|
<h2>Pipeline Diagnostics</h2>
|
||||||
</div>
|
</div>
|
||||||
<p class="card-desc">Trigger structured C# logs using Dependency Injected ILogger.</p>
|
<div class="config-grid">
|
||||||
<div class="btn-group">
|
<div class="config-item">
|
||||||
<button class="btn btn-info" @onclick="LogInfo">
|
<span class="label">Rolling Daily File Sandbox Path</span>
|
||||||
<NexusIcon Name="info" Size="16" />
|
<span class="value code-value">AppDataDirectory/logs/log-*.txt</span>
|
||||||
Log Info
|
</div>
|
||||||
</button>
|
<div class="config-item">
|
||||||
<button class="btn btn-warning" @onclick="LogWarning">
|
<span class="label">Active Configuration Provider</span>
|
||||||
<NexusIcon Name="alert-triangle" Size="16" />
|
<span class="value">Serilog.Settings.Configuration (appsettings.json)</span>
|
||||||
Log Warning
|
</div>
|
||||||
</button>
|
<div class="config-item">
|
||||||
<button class="btn btn-error" @onclick="LogError">
|
<span class="label">Native Apple Console Sink</span>
|
||||||
<NexusIcon Name="x-circle" Size="16" />
|
<span class="value">Serilog.Sinks.Debug (conditional compilation)</span>
|
||||||
Log Error Exception
|
</div>
|
||||||
</button>
|
<div class="config-item">
|
||||||
</div>
|
<span class="label">Native Android Logcat Sink</span>
|
||||||
</div>
|
<span class="value">AndroidLogcatSink (direct JNI bindings)</span>
|
||||||
|
</div>
|
||||||
<!-- Blazor / JS Interop Bridge Panel -->
|
|
||||||
<div class="control-card glass-panel">
|
|
||||||
<div class="card-header">
|
|
||||||
<NexusIcon Name="globe" Size="20" Class="card-icon js-icon" />
|
|
||||||
<h2>Blazor / JS WebView Logs</h2>
|
|
||||||
</div>
|
|
||||||
<p class="card-desc">Trigger logs from JavaScript to verify the interop error capture bridge.</p>
|
|
||||||
<div class="btn-group">
|
|
||||||
<button class="btn btn-js-info" @onclick="TriggerJsLog">
|
|
||||||
<NexusIcon Name="message-square" Size="16" />
|
|
||||||
Trigger console.log()
|
|
||||||
</button>
|
|
||||||
<button class="btn btn-js-error" @onclick="TriggerJsException">
|
|
||||||
<NexusIcon Name="zap" Size="16" />
|
|
||||||
Trigger JS Exception
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
<!-- Active Log Config Panel -->
|
else
|
||||||
<div class="config-card glass-panel">
|
{
|
||||||
<div class="card-header">
|
<div class="serilog-demo-container">
|
||||||
<NexusIcon Name="settings" Size="20" Class="card-icon" />
|
<div class="glass-panel" style="text-align: center; padding: 3rem;">
|
||||||
<h2>Pipeline Diagnostics</h2>
|
<h2>Diagnostics Unavailable</h2>
|
||||||
</div>
|
<p>This page is only available in DEBUG builds.</p>
|
||||||
<div class="config-grid">
|
|
||||||
<div class="config-item">
|
|
||||||
<span class="label">Rolling Daily File Sandbox Path</span>
|
|
||||||
<span class="value code-value">AppDataDirectory/logs/log-*.txt</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item">
|
|
||||||
<span class="label">Active Configuration Provider</span>
|
|
||||||
<span class="value">Serilog.Settings.Configuration (appsettings.json)</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item">
|
|
||||||
<span class="label">Native Apple Console Sink</span>
|
|
||||||
<span class="value">Serilog.Sinks.Debug (conditional compilation)</span>
|
|
||||||
</div>
|
|
||||||
<div class="config-item">
|
|
||||||
<span class="label">Native Android Logcat Sink</span>
|
|
||||||
<span class="value">AndroidLogcatSink (direct JNI bindings)</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
#else
|
|
||||||
<div class="serilog-demo-container">
|
|
||||||
<div class="glass-panel" style="text-align: center; padding: 3rem;">
|
|
||||||
<h2>Diagnostics Unavailable</h2>
|
|
||||||
<p>This page is only available in DEBUG builds.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
private readonly bool _isDebug = true;
|
||||||
|
#else
|
||||||
|
private readonly bool _isDebug = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
private void LogInfo()
|
private void LogInfo()
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
Logger.LogInformation("Structured native log triggered by user from SerilogDemo. Button: LogInfo");
|
Logger.LogInformation("Structured native log triggered by user from SerilogDemo. Button: LogInfo");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LogWarning()
|
private void LogWarning()
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
Logger.LogWarning("Potential warning log triggered from Blazor razor component at {Time}", DateTime.UtcNow);
|
Logger.LogWarning("Potential warning log triggered from Blazor razor component at {Time}", DateTime.UtcNow);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LogError()
|
private void LogError()
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Simulated native C# operation exception triggered in Diagnostic dashboard.");
|
throw new InvalidOperationException("Simulated native C# operation exception triggered in Diagnostic dashboard.");
|
||||||
@@ -120,16 +132,22 @@
|
|||||||
{
|
{
|
||||||
Logger.LogError(ex, "Captured exception successfully in native Serilog pipeline!");
|
Logger.LogError(ex, "Captured exception successfully in native Serilog pipeline!");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task TriggerJsLog()
|
private async Task TriggerJsLog()
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
await JSRuntime.InvokeVoidAsync("console.log", "Intercepted JS console statement from Blazor WebView interop trigger!");
|
await JSRuntime.InvokeVoidAsync("console.log", "Intercepted JS console statement from Blazor WebView interop trigger!");
|
||||||
|
#endif
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task TriggerJsException()
|
private async Task TriggerJsException()
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
await JSRuntime.InvokeVoidAsync("eval", "throw new Error('Simulated runtime JS Exception triggered from Blazor UI button click!');");
|
await JSRuntime.InvokeVoidAsync("eval", "throw new Error('Simulated runtime JS Exception triggered from Blazor UI button click!');");
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
await Task.CompletedTask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user