2022-01-21 13:54:22 +00:00
|
|
|
@using NLog
|
|
|
|
@using NLog.Targets
|
2022-01-20 08:34:38 +00:00
|
|
|
@namespace Wabbajack.App.Blazor.Components
|
|
|
|
|
2022-01-17 16:45:52 +00:00
|
|
|
<div id="virtual-logger">
|
2022-01-21 13:54:22 +00:00
|
|
|
<Virtualize Items="@Logs" Context="logItem" OverscanCount="3">
|
|
|
|
<span @key="logItem">@logItem</span>
|
2022-01-17 16:45:52 +00:00
|
|
|
</Virtualize>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
|
|
|
// TODO: [Low] More parameters to customise the logger. E.g. Reverse order.
|
|
|
|
// TODO: [High] Find a way to auto-scroll. (JS interop?)
|
|
|
|
|
2022-01-21 13:54:22 +00:00
|
|
|
private MemoryTarget? _memoryTarget;
|
|
|
|
private ICollection<string> Logs => _memoryTarget?.Logs ?? Array.Empty<string>();
|
2022-01-17 16:45:52 +00:00
|
|
|
|
2022-01-21 13:54:22 +00:00
|
|
|
protected override void OnInitialized()
|
|
|
|
{
|
|
|
|
_memoryTarget = LogManager.Configuration.FindTargetByName<MemoryTarget>("ui");
|
2022-01-17 16:45:52 +00:00
|
|
|
}
|
|
|
|
}
|