44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System.Globalization;
|
|
using AyCode.Core.Consts;
|
|
using AyCode.Core.Enums;
|
|
using AyCode.Core.Loggers;
|
|
using AyCode.Services.Loggers;
|
|
using Microsoft.JSInterop;
|
|
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
|
|
|
namespace TIAMWebApp.Shared.Application.Utility;
|
|
|
|
//public interface IBrowserConsoleLogWriter : IAcLogWriterBase
|
|
//{ }
|
|
|
|
//public abstract class LogWriterClient : AcTextLogWriterBase
|
|
//{
|
|
// protected LogWriterClient(IJSRuntime jsRuntime) : base(AppType.Web, LogLevel.Debug)
|
|
// { }
|
|
//}
|
|
|
|
public class BrowserConsoleLogWriter : AcTextLogWriterBase, IAcLogWriterClientBase
|
|
{
|
|
private readonly IJSRuntime _jsRuntime;
|
|
|
|
//public BrowserConsoleLogWriter() : base(AppType.Web, LogLevel.Debug)
|
|
//{
|
|
// _jsRuntime = Services.GetRequiredService<IJSRuntime>();
|
|
//}
|
|
|
|
public BrowserConsoleLogWriter(IJSRuntime jsRuntime) : base(AppType.Web, LogLevel.Debug)
|
|
{
|
|
_jsRuntime = jsRuntime;
|
|
}
|
|
|
|
protected override void WriteText(string? logText, LogLevel logLevel)
|
|
{
|
|
_jsRuntime.InvokeVoidAsync("console.log", logText);
|
|
}
|
|
|
|
//public void Info(string message)
|
|
//{
|
|
// ((AcLogWriterBase)this).Info(message);
|
|
// //jsRuntime.InvokeVoidAsync("console.log", logText);
|
|
//}
|
|
} |