Update Hub to .NET 8 and all OpenTelemetry

This commit is contained in:
2024-01-27 16:25:14 -05:00
parent d8fd6d13f9
commit 9cddb80f00
12 changed files with 78 additions and 125 deletions

View File

@@ -1,17 +1,17 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.SignalR;
using System;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace ChrisKaczor.HomeMonitor.Hub.Service.Hubs
{
[UsedImplicitly]
public class DeviceStatusHub : Microsoft.AspNetCore.SignalR.Hub
public class DeviceStatusHub(ILogger<DeviceStatusHub> logger) : Microsoft.AspNetCore.SignalR.Hub
{
[UsedImplicitly]
public async Task RequestLatestStatus()
{
Console.WriteLine("RequestLatestStatus");
logger.LogInformation("RequestLatestStatus");
await Clients.Others.SendAsync("RequestLatestStatus");
}
@@ -19,7 +19,7 @@ namespace ChrisKaczor.HomeMonitor.Hub.Service.Hubs
[UsedImplicitly]
public async Task SendLatestStatus(string message)
{
Console.WriteLine($"LatestStatus: {message}");
logger.LogInformation($"LatestStatus: {message}");
await Clients.Others.SendAsync("LatestStatus", message);
}

View File

@@ -1,17 +1,17 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.SignalR;
using System;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace ChrisKaczor.HomeMonitor.Hub.Service.Hubs
{
[UsedImplicitly]
public class EnvironmentHub : Microsoft.AspNetCore.SignalR.Hub
public class EnvironmentHub(ILogger<EnvironmentHub> logger) : Microsoft.AspNetCore.SignalR.Hub
{
[UsedImplicitly]
public async Task SendMessage(string message)
{
Console.WriteLine(message);
logger.LogInformation(message);
await Clients.Others.SendAsync("Message", message);
}

View File

@@ -1,17 +1,17 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.SignalR;
using System;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace ChrisKaczor.HomeMonitor.Hub.Service.Hubs
{
[UsedImplicitly]
public class PowerHub : Microsoft.AspNetCore.SignalR.Hub
public class PowerHub(ILogger<PowerHub> logger) : Microsoft.AspNetCore.SignalR.Hub
{
[UsedImplicitly]
public async Task SendLatestSample(string message)
{
Console.WriteLine(message);
logger.LogInformation(message);
await Clients.Others.SendAsync("LatestSample", message);
}

View File

@@ -1,17 +1,17 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.SignalR;
using System;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace ChrisKaczor.HomeMonitor.Hub.Service.Hubs
{
[UsedImplicitly]
public class WeatherHub : Microsoft.AspNetCore.SignalR.Hub
public class WeatherHub(ILogger<WeatherHub> logger) : Microsoft.AspNetCore.SignalR.Hub
{
[UsedImplicitly]
public async Task SendLatestReading(string message)
{
Console.WriteLine(message);
logger.LogInformation(message);
await Clients.Others.SendAsync("LatestReading", message);
}