LANCommander/LANCommander.Server/Hubs/LoggingHub.cs

22 lines
687 B
C#
Raw Permalink Normal View History

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;
2024-08-04 18:44:33 -05:00
namespace LANCommander.Server.Hubs
{
public class LoggingHub : Hub
{
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)
{
2024-08-29 00:19:56 -05:00
await context.Clients.All.SendAsync("Log", message, logEvent.Level, logEvent.Timestamp.DateTime);
}
}
2024-08-29 00:19:56 -05:00
}