2024-01-29 22:29:47 -06:00
|
|
|
|
using LANCommander.SDK;
|
2024-08-04 18:44:33 -05:00
|
|
|
|
using LANCommander.Server.Services;
|
2023-08-15 20:15:53 -05:00
|
|
|
|
using Microsoft.AspNetCore.SignalR;
|
2024-08-29 00:19:56 -05:00
|
|
|
|
using Serilog.Events;
|
2023-04-13 17:43:26 -05:00
|
|
|
|
|
2024-08-04 18:44:33 -05:00
|
|
|
|
namespace LANCommander.Server.Hubs
|
2023-04-13 17:43:26 -05:00
|
|
|
|
{
|
2024-01-29 22:29:47 -06:00
|
|
|
|
public class LoggingHub : Hub
|
2023-04-13 17:43:26 -05:00
|
|
|
|
{
|
2025-02-08 19:32:16 -06:00
|
|
|
|
public override async Task OnConnectedAsync()
|
|
|
|
|
|
{
|
|
|
|
|
|
Clients.Caller.SendAsync("Log", "Connected to server logging provider!", LogEventLevel.Information, DateTime.Now);
|
|
|
|
|
|
await base.OnConnectedAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-29 00:19:56 -05:00
|
|
|
|
public static async Task Log(IHubContext<LoggingHub> context, string message, LogEvent logEvent)
|
2023-04-13 17:43:26 -05:00
|
|
|
|
{
|
2024-08-29 00:19:56 -05:00
|
|
|
|
|
|
|
|
|
|
await context.Clients.All.SendAsync("Log", message, logEvent.Level, logEvent.Timestamp.DateTime);
|
2023-04-13 17:43:26 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-08-29 00:19:56 -05:00
|
|
|
|
}
|