feat: adds methods to get/set websocket min log level

This commit is contained in:
Neil Dorin
2023-11-22 17:31:36 -07:00
parent 3debb30d53
commit 65800193bb
2 changed files with 9 additions and 3 deletions

View File

@@ -11,7 +11,6 @@ using PepperDash.Core.DebugThings;
using Serilog; using Serilog;
using Serilog.Core; using Serilog.Core;
using Serilog.Events; using Serilog.Events;
using Serilog.Formatting.Compact;
using Serilog.Formatting.Json; using Serilog.Formatting.Json;
namespace PepperDash.Core namespace PepperDash.Core
@@ -47,6 +46,11 @@ namespace PepperDash.Core
private static LoggingLevelSwitch _websocketLoggingLevelSwitch; private static LoggingLevelSwitch _websocketLoggingLevelSwitch;
public static LogEventLevel WebsocketMinimumLogLevel
{
get { return _websocketLoggingLevelSwitch.MinimumLevel; }
}
private static DebugWebsocketSink _websocketSink; private static DebugWebsocketSink _websocketSink;
public static DebugWebsocketSink WebsocketSink public static DebugWebsocketSink WebsocketSink
@@ -265,9 +269,11 @@ namespace PepperDash.Core
_consoleLoggingLevelSwitch.MinimumLevel = level; _consoleLoggingLevelSwitch.MinimumLevel = level;
} }
public static void SetWebSocketDebugLevel(LogEventLevel level) public static void SetWebSocketMinimumDebugLevel(LogEventLevel level)
{ {
_websocketLoggingLevelSwitch.MinimumLevel = level;
Console(0, "Websocket debug level set to {0}", _websocketLoggingLevelSwitch.MinimumLevel);
} }
/// <summary> /// <summary>

View File

@@ -22,7 +22,7 @@ namespace PepperDash.Core
{ {
if (!Debug.IsRunningOnAppliance) return; if (!Debug.IsRunningOnAppliance) return;
CrestronConsole.PrintLine("[{0}]App {1} Lvl {2}:{3}", logEvent.Timestamp, CrestronConsole.PrintLine("[{0}][App {1}][Lvl {2}]: {3}", logEvent.Timestamp,
InitialParametersClass.ApplicationNumber, InitialParametersClass.ApplicationNumber,
logEvent.Level, logEvent.Level,
logEvent.RenderMessage()); logEvent.RenderMessage());