Add admin client log diagnostics page
TaxBaik CI/CD / build-and-deploy (push) Successful in 5m11s

This commit is contained in:
2026-07-08 01:56:24 +09:00
parent 30275c7952
commit d0bec6c909
3 changed files with 174 additions and 0 deletions
@@ -0,0 +1,76 @@
@page "/client-logs"
@page "/admin/client-logs"
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
@attribute [Authorize]
@inject HttpClient Http
<PageTitle>클라이언트 로그</PageTitle>
<section class="admin-simple-page">
<header class="admin-simple-header">
<p class="admin-simple-eyebrow">Diagnostics</p>
<h1 class="admin-simple-title">클라이언트 로그</h1>
<p class="admin-simple-subtitle">브라우저 오류와 JS interop 실패를 최근 순서로 확인합니다.</p>
</header>
<div class="admin-simple-card">
@if (_loading)
{
<p>불러오는 중...</p>
}
else if (_entries.Count == 0)
{
<p>최근 클라이언트 로그가 없습니다.</p>
}
else
{
<div class="admin-log-list">
@foreach (var entry in _entries)
{
<article class="admin-log-item">
<div class="admin-log-item-header">
<strong>@(entry.Level ?? "error")</strong>
<span>@entry.Timestamp</span>
<span>@entry.Source</span>
</div>
<p>@entry.Message</p>
<small>@entry.Route</small>
</article>
}
</div>
}
</div>
</section>
@code {
private readonly List<ClientLogDto> _entries = [];
private bool _loading = true;
protected override async Task OnInitializedAsync()
{
try
{
var result = await Http.GetFromJsonAsync<List<ClientLogDto>>("/taxbaik/api/client-logs/recent");
if (result is not null)
{
_entries.AddRange(result);
}
}
catch
{
}
finally
{
_loading = false;
}
}
private sealed class ClientLogDto
{
public string? Timestamp { get; set; }
public string? Level { get; set; }
public string? Source { get; set; }
public string? Message { get; set; }
public string? Route { get; set; }
}
}