feat: Initial implementation of DebugWebsocketSink

This commit is contained in:
Neil Dorin
2023-10-30 17:24:47 -06:00
parent 6174400b7e
commit 2f1180512c
5 changed files with 141 additions and 7 deletions

View File

@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Serilog;
using Serilog.Core;
using Serilog.Sinks.SystemConsole;
namespace PepperDash.Core
{
@@ -8,8 +11,12 @@ namespace PepperDash.Core
/// <summary>
/// The core event and status-bearing class that most if not all device and connectors can derive from.
/// </summary>
public class Device : IKeyName
public class Device : IKeyNameWithLogging
{
public ILogger Logger { get; private set; }
private static LoggingLevelSwitch _loggingLevelSwitch;
/// <summary>
/// Unique Key
/// </summary>
@@ -52,6 +59,9 @@ namespace PepperDash.Core
if (key.Contains('.')) Debug.Console(0, this, "WARNING: Device name's should not include '.'");
Name = "";
_loggingLevelSwitch = new LoggingLevelSwitch();
Logger = Serilog.Log.ForContext("Key", Key);
}
/// <summary>