wabbajack/Wabbajack.App.Blazor/Utility/UILoggerTarget.cs
2022-01-28 11:29:38 +01:00

18 lines
398 B
C#

using System;
using System.Reactive.Subjects;
using NLog;
using NLog.Targets;
namespace Wabbajack.App.Blazor.Utility;
public class UiLoggerTarget : TargetWithLayout
{
private readonly Subject<string> _logs = new();
public IObservable<string> Logs => _logs;
protected override void Write(LogEventInfo logEvent)
{
_logs.OnNext(RenderLogEvent(Layout, logEvent));
}
}