From 37c1a6c7dde88dde1a60ac5d47fe16e078a8fee4 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Tue, 5 Nov 2024 13:30:01 -0500 Subject: [PATCH] feat: implemented logging by key with Core - updated log methods in a few places --- src/Directory.Build.targets | 8 +- .../Devices/DeviceJsonApi.cs | 14 +-- .../Factory/DeviceFactory.cs | 2 +- ...lsHuddleSpaceFusionSystemControllerBase.cs | 23 ++-- .../Global/Global.cs | 2 +- .../Global/Scheduler.cs | 4 - .../JoinMaps/JoinMapBase.cs | 6 - .../PepperDash.Essentials.Core.csproj | 5 +- .../Plugins/PluginLoader.cs | 73 +++++------ .../Routing/RoutingFeedbackManager.cs | 10 +- .../RequestHandlers/AppDebugRequestHandler.cs | 5 +- .../DebugSessionRequestHandler.cs | 27 +---- .../RequestHandlers/DevJsonRequestHandler.cs | 5 +- .../Cameras/CameraVisca.cs | 4 +- .../Displays/MockDisplay.cs | 12 +- ...epperDash.Essentials.Devices.Common.csproj | 5 +- .../VideoCodec/VideoCodecBase.cs | 1 - src/PepperDash.Essentials/ControlSystem.cs | 7 +- .../PepperDash.Essentials.csproj | 114 +++++++++--------- 19 files changed, 144 insertions(+), 183 deletions(-) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 83bbc930..8dfcea7f 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -15,11 +15,15 @@ - + - + + + + + diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs index 4fd97f22..61985641 100644 --- a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs +++ b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs @@ -91,7 +91,7 @@ namespace PepperDash.Essentials.Core } catch (Exception e) { - Debug.LogMessage(e, "Error invoking method {methodName} on device {deviceKey}", null, method.Name, action.DeviceKey); + Debug.LogError(e, "Error invoking method {methodName} on device {deviceKey}", null, method.Name, action.DeviceKey); } }); @@ -111,7 +111,7 @@ namespace PepperDash.Essentials.Core var obj = FindObjectOnPath(key); if (obj == null) { - Debug.LogMessage(LogEventLevel.Warning, "Unable to find object at path {deviceKey}", null, key); + Debug.LogMessage(LogEventLevel.Warning, "Unable to find object at path {deviceKey}", key); return; } @@ -130,9 +130,7 @@ namespace PepperDash.Essentials.Core if (method == null) { - Debug.LogMessage(LogEventLevel.Warning, - "Unable to find method with name {methodName} and that matches parameters {@parameters}", null, action.MethodName, - action.Params); + Debug.LogMessage(LogEventLevel.Warning, "Unable to find method with name {methodName} and that matches parameters {@parameters}", action.MethodName, action.Params); return; } var mParams = method.GetParameters(); @@ -145,18 +143,18 @@ namespace PepperDash.Essentials.Core { try { - Debug.LogMessage(LogEventLevel.Verbose, "Calling method {methodName} on device {deviceKey} with {@params}", null, method.Name, action.DeviceKey, action.Params); + Debug.LogMessage(LogEventLevel.Verbose, "Calling method {methodName} on device {deviceKey} with {@params}", method.Name, action.DeviceKey, action.Params); method.Invoke(obj, convertedParams); } catch (Exception e) { - Debug.LogMessage(e, "Error invoking method {methodName} on device {deviceKey}", null, method.Name, action.DeviceKey); + Debug.LogError(e, "Error invoking method {methodName} on device {deviceKey}", method.Name, action.DeviceKey); } }); } catch (Exception ex) { - Debug.LogMessage(ex, "Unable to call method with name {methodName} with {@parameters}", null, action.MethodName, action.Params); + Debug.LogError(ex, "Unable to call method with name {methodName} with {@parameters}", action.MethodName, action.Params); } } diff --git a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs index 07bcc56a..51e0069c 100644 --- a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs +++ b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs @@ -149,7 +149,7 @@ namespace PepperDash.Essentials.Core } catch (Exception ex) { - Debug.LogMessage(ex, "Exception occurred while creating device {0}: {1}", null, dc.Key, ex.Message); + Debug.LogError(ex, "Exception occurred while creating device {0}: {1}", dc.Key, ex.Message); return null; } } diff --git a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index 04f2490a..724220b9 100644 --- a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -1040,21 +1040,18 @@ namespace PepperDash.Essentials.Core.Fusion /// private void PrintTodaysSchedule() { - if (Debug.Level > 1) + if (_currentSchedule.Meetings.Count > 0) { - if (_currentSchedule.Meetings.Count > 0) - { - Debug.LogMessage(LogEventLevel.Debug, this, "Today's Schedule for '{0}'\n", Room.Name); + Debug.LogMessage(LogEventLevel.Debug, this, "Today's Schedule for '{0}'\n", Room.Name); - foreach (var e in _currentSchedule.Meetings) - { - Debug.LogMessage(LogEventLevel.Debug, this, "Subject: {0}", e.Subject); - Debug.LogMessage(LogEventLevel.Debug, this, "Organizer: {0}", e.Organizer); - Debug.LogMessage(LogEventLevel.Debug, this, "MeetingID: {0}", e.MeetingID); - Debug.LogMessage(LogEventLevel.Debug, this, "Start Time: {0}", e.dtStart); - Debug.LogMessage(LogEventLevel.Debug, this, "End Time: {0}", e.dtEnd); - Debug.LogMessage(LogEventLevel.Debug, this, "Duration: {0}\n", e.DurationInMinutes); - } + foreach (var e in _currentSchedule.Meetings) + { + Debug.LogMessage(LogEventLevel.Debug, this, "Subject: {0}", e.Subject); + Debug.LogMessage(LogEventLevel.Debug, this, "Organizer: {0}", e.Organizer); + Debug.LogMessage(LogEventLevel.Debug, this, "MeetingID: {0}", e.MeetingID); + Debug.LogMessage(LogEventLevel.Debug, this, "Start Time: {0}", e.dtStart); + Debug.LogMessage(LogEventLevel.Debug, this, "End Time: {0}", e.dtEnd); + Debug.LogMessage(LogEventLevel.Debug, this, "Duration: {0}\n", e.DurationInMinutes); } } } diff --git a/src/PepperDash.Essentials.Core/Global/Global.cs b/src/PepperDash.Essentials.Core/Global/Global.cs index 9e4b6462..f3523eba 100644 --- a/src/PepperDash.Essentials.Core/Global/Global.cs +++ b/src/PepperDash.Essentials.Core/Global/Global.cs @@ -35,7 +35,7 @@ namespace PepperDash.Essentials.Core public static eCrestronSeries ProcessorSeries { get { return CrestronEnvironment.ProgramCompatibility; } } // TODO: consider making this configurable later - public static IFormatProvider Culture = CultureInfo.CreateSpecificCulture("en-US"); + public static IFormatProvider Culture = CultureInfo.InvariantCulture; /// /// True when the processor type is a DMPS variant diff --git a/src/PepperDash.Essentials.Core/Global/Scheduler.cs b/src/PepperDash.Essentials.Core/Global/Scheduler.cs index e226ce5c..5e31852c 100644 --- a/src/PepperDash.Essentials.Core/Global/Scheduler.cs +++ b/src/PepperDash.Essentials.Core/Global/Scheduler.cs @@ -1,15 +1,11 @@ using System; using System.Collections.Generic; -using System.Linq; using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; using Crestron.SimplSharp.Scheduler; using PepperDash.Core; -using PepperDash.Essentials.Core.Fusion; using PepperDash.Essentials.Room.Config; using Serilog.Events; -using Activator = System.Activator; namespace PepperDash.Essentials.Core { diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs index 37760e09..8476d734 100644 --- a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs +++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs @@ -134,12 +134,6 @@ namespace PepperDash.Essentials.Core Joins.Add(joinName, value); } - - - if (Debug.Level > 0) - { - PrintJoinMapInfo(); - } } /// diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index c074651a..d82e2cc7 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -25,8 +25,9 @@ pdbonly - - + + + diff --git a/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs b/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs index 4759b2cd..969a6acc 100644 --- a/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs +++ b/src/PepperDash.Essentials.Core/Plugins/PluginLoader.cs @@ -102,14 +102,11 @@ namespace PepperDash.Essentials LoadedAssemblies.Add(new LoadedAssembly(fi.Name, version, assembly)); } - if (Debug.Level > 1) - { - Debug.LogMessage(LogEventLevel.Verbose, "Loaded Assemblies:"); + Debug.LogMessage(LogEventLevel.Verbose, "Loaded Assemblies:"); - foreach (var assembly in LoadedAssemblies) - { - Debug.LogMessage(LogEventLevel.Verbose, "Assembly: {0}", assembly.Name); - } + foreach (var assembly in LoadedAssemblies) + { + Debug.LogMessage(LogEventLevel.Verbose, "Assembly: {0}", assembly.Name); } } @@ -151,7 +148,7 @@ namespace PepperDash.Essentials return null; } catch(Exception ex) { - Debug.LogMessage(ex, "Error loading assembly from {path}", null, filePath); + Debug.LogError(ex, "Error loading assembly from {path}", filePath); return null; } @@ -360,8 +357,8 @@ namespace PepperDash.Essentials foreach (var pluginFile in pluginFiles) { var loadedAssembly = LoadAssembly(pluginFile.FullName); - - LoadedPluginFolderAssemblies.Add(loadedAssembly); + if (loadedAssembly != null) + LoadedPluginFolderAssemblies.Add(loadedAssembly); } Debug.LogMessage(LogEventLevel.Information, "All Plugins Loaded."); @@ -379,50 +376,44 @@ namespace PepperDash.Essentials try { var assy = loadedAssembly.Assembly; - Type[] types = {}; try { - types = assy.GetTypes(); + var types = assy.GetTypes().ToList(); Debug.LogMessage(LogEventLevel.Debug, $"Got types for assembly {assy.GetName().Name}"); + + foreach (var type in types) + { + try + { + if (typeof(IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract) + { + var plugin = (IPluginDeviceFactory)Activator.CreateInstance(type); + LoadCustomPlugin(plugin, loadedAssembly); + } + } + catch (NotSupportedException) + { + //this happens for dlls that aren't PD dlls, like ports of Mono classes into S#. Swallowing. + } + catch (Exception e) + { + Debug.LogError(e, "Error loading plugin type: {Type}", type.Name); + } + } } catch (TypeLoadException e) { - Debug.LogMessage(LogEventLevel.Error, "Unable to get types for assembly {0}: {1}", - loadedAssembly.Name, e.Message); - Debug.LogMessage(LogEventLevel.Verbose, e.StackTrace); - continue; + Debug.LogError(e, "Unable to get types for assembly {0}", loadedAssembly.Name); } - - foreach (var type in types) + catch (Exception e) { - try - { - if (typeof (IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract) - { - var plugin = - (IPluginDeviceFactory)Activator.CreateInstance(type); - LoadCustomPlugin(plugin, loadedAssembly); - } - } - catch (NotSupportedException) - { - //this happens for dlls that aren't PD dlls, like ports of Mono classes into S#. Swallowing. - } - catch (Exception e) - { - Debug.LogMessage(LogEventLevel.Error, "Load Plugin not found. {0}.{2} is not a plugin factory. Exception: {1}", - loadedAssembly.Name, e.Message, type.Name); - continue; - } + Debug.LogError(e, "Unable to get types for assembly {0}", loadedAssembly.Name); } } catch (Exception e) { - Debug.LogMessage(LogEventLevel.Information, "Error Loading assembly {0}: {1}", - loadedAssembly.Name, e.Message); - Debug.LogMessage(LogEventLevel.Verbose, "{0}", e.StackTrace); - continue; + Debug.LogError(e, "Error loading plugin assembly:{Assembly}", loadedAssembly); } } // plugin dll will be loaded. Any classes in plugin should have a static constructor diff --git a/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs b/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs index 4e2ccc5b..a3b9a588 100644 --- a/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs +++ b/src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs @@ -47,7 +47,7 @@ namespace PepperDash.Essentials.Core.Routing } catch (Exception ex) { - Debug.LogMessage(ex, "Error handling midpoint update from {midpointKey}:{Exception}", this, midpoint.Key, ex); + Debug.LogError(ex, "Error handling midpoint update from {midpointKey}:{Exception}", this, midpoint.Key, ex); } } @@ -59,7 +59,7 @@ namespace PepperDash.Essentials.Core.Routing } catch (Exception ex) { - Debug.LogMessage(ex, "Error handling Sink update from {senderKey}:{Exception}", this, sender.Key, ex); + Debug.LogError(ex, "Error handling Sink update from {senderKey}:{Exception}", this, sender.Key, ex); } } @@ -97,7 +97,7 @@ namespace PepperDash.Essentials.Core.Routing } } catch (Exception ex) { - Debug.LogMessage(ex, "Error getting first tieline: {Exception}", this, ex); + Debug.LogError(this, ex, "Error getting first tieline: {Exception}", ex); return; } @@ -124,7 +124,7 @@ namespace PepperDash.Essentials.Core.Routing } } catch(Exception ex) { - Debug.LogMessage(ex, "Error getting sourceTieLine: {Exception}", this, ex); + Debug.LogError(this, ex, "Error getting sourceTieLine: {Exception}", ex); return; } @@ -261,7 +261,7 @@ namespace PepperDash.Essentials.Core.Routing } } catch (Exception ex) { - Debug.LogMessage(ex, "Error walking tieLines: {Exception}", this, ex); + Debug.LogError(this, ex, "Error walking tieLines: {Exception}", ex); return null; } diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs index 0b7497d2..d54c8400 100644 --- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs +++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/AppDebugRequestHandler.cs @@ -2,7 +2,6 @@ using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Core.Web.RequestHandlers; -using System; using Serilog.Events; using Newtonsoft.Json.Converters; @@ -27,7 +26,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers /// protected override void HandleGet(HttpCwsContext context) { - var appDebug = new AppDebug { MinimumLevel = Debug.WebsocketMinimumLogLevel }; + var appDebug = new AppDebug { MinimumLevel = Debug.WebsocketMinimumLevel }; var body = JsonConvert.SerializeObject(appDebug, Formatting.Indented); @@ -67,7 +66,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers Debug.SetWebSocketMinimumDebugLevel(requestBody.MinimumLevel); - appDebug.MinimumLevel = Debug.WebsocketMinimumLogLevel; + appDebug.MinimumLevel = Debug.WebsocketMinimumLevel; var responseBody = JsonConvert.SerializeObject(appDebug, Formatting.Indented); context.Response.StatusCode = 200; diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DebugSessionRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DebugSessionRequestHandler.cs index 80c7bfbe..5b8ccad0 100644 --- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DebugSessionRequestHandler.cs +++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DebugSessionRequestHandler.cs @@ -24,7 +24,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers /// Gets details for a debug session /// /// - protected override void HandleGet(Crestron.SimplSharp.WebScripting.HttpCwsContext context) + protected override void HandleGet(HttpCwsContext context) { var routeData = context.Request.RouteData; if (routeData == null) @@ -38,29 +38,12 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers try { - var ip = CrestronEthernetHelper.GetEthernetParameter( - CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0); - - var port = 0; - - if (!Debug.WebsocketSink.IsRunning) + var data = new { - Debug.LogMessage(LogEventLevel.Information, "Starting WS Server"); - // Generate a random port within a specified range - port = new Random().Next(65435, 65535); - // Start the WS Server - Debug.WebsocketSink.StartServerAndSetPort(port); - Debug.SetWebSocketMinimumDebugLevel(Serilog.Events.LogEventLevel.Verbose); - } - - var url = Debug.WebsocketSink.Url; - - object data = new - { - url = Debug.WebsocketSink.Url + url = "" // TODO: Add the URL of the websocket server }; - Debug.LogMessage(LogEventLevel.Information, "Debug Session URL: {0}", url); + Debug.LogMessage(LogEventLevel.Information, "Debug Session URL: {0}", data.url); // Return the port number with the full url of the WS Server var res = JsonConvert.SerializeObject(data); @@ -84,8 +67,6 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers /// protected override void HandlePost(HttpCwsContext context) { - Debug.WebsocketSink.StopServer(); - context.Response.StatusCode = 200; context.Response.StatusDescription = "OK"; context.Response.End(); diff --git a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevJsonRequestHandler.cs b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevJsonRequestHandler.cs index d14ffb83..358394ad 100644 --- a/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevJsonRequestHandler.cs +++ b/src/PepperDash.Essentials.Core/Web/RequestHandlers/DevJsonRequestHandler.cs @@ -71,8 +71,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers var daw = new DeviceActionWrapper { DeviceKey = (string) deviceKey}; JsonConvert.PopulateObject(data, daw); - - Debug.LogMessage(LogEventLevel.Verbose, "Device Action Wrapper: {@wrapper}", null, daw); + Debug.LogMessage(LogEventLevel.Verbose, "Device Action Wrapper: {@wrapper}", null, daw); DeviceJsonApi.DoDeviceAction(daw); @@ -82,7 +81,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers } catch (Exception ex) { - Debug.LogMessage(ex, "Error handling device command: {Exception}"); + Debug.LogError(ex, "Error handling device command: {Exception}"); context.Response.StatusCode = 400; context.Response.StatusDescription = "Bad Request"; diff --git a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs index fa82ba1f..d0423946 100644 --- a/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs +++ b/src/PepperDash.Essentials.Devices.Common/Cameras/CameraVisca.cs @@ -193,7 +193,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras void SendBytes(byte[] b) { - if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1 + if (Debug.ConsoleMinimumLevel == LogEventLevel.Verbose) // This check is here to prevent following string format from building unnecessarily on level 0 or 1 Debug.LogMessage(LogEventLevel.Verbose, this, "Sending:{0}", ComTextHelper.GetEscapedText(b)); Communication.SendBytes(b); @@ -209,7 +209,7 @@ namespace PepperDash.Essentials.Devices.Common.Cameras // Append the incoming bytes with whatever is in the buffer IncomingBuffer.CopyTo(newBytes, 0); e.Bytes.CopyTo(newBytes, IncomingBuffer.Length); - if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1 + if (Debug.ConsoleMinimumLevel == LogEventLevel.Verbose) // This check is here to prevent following string format from building unnecessarily on level 0 or 1 Debug.LogMessage(LogEventLevel.Verbose, this, "Received:{0}", ComTextHelper.GetEscapedText(newBytes)); byte[] message = new byte[] { }; diff --git a/src/PepperDash.Essentials.Devices.Common/Displays/MockDisplay.cs b/src/PepperDash.Essentials.Devices.Common/Displays/MockDisplay.cs index 0fecadc5..85ab7037 100644 --- a/src/PepperDash.Essentials.Devices.Common/Displays/MockDisplay.cs +++ b/src/PepperDash.Essentials.Devices.Common/Displays/MockDisplay.cs @@ -120,7 +120,7 @@ namespace PepperDash.Essentials.Devices.Common.Displays // Fake cool-down cycle CooldownTimer = new CTimer(o => { - Debug.LogMessage(LogEventLevel.Verbose, "Cooldown timer ending", this); + Debug.LogMessage(LogEventLevel.Verbose, this, "Cooldown timer ending"); _IsCoolingDown = false; IsCoolingDownFeedback.InvokeFireUpdate(); _PowerIsOn = false; @@ -141,7 +141,7 @@ namespace PepperDash.Essentials.Devices.Common.Displays { try { - Debug.LogMessage(LogEventLevel.Verbose, "ExecuteSwitch: {0}", this, selector); + Debug.LogMessage(LogEventLevel.Verbose, this, "ExecuteSwitch: {0}", selector); if (!_PowerIsOn) { @@ -156,21 +156,21 @@ namespace PepperDash.Essentials.Devices.Common.Displays var inputPort = InputPorts.FirstOrDefault(port => { - Debug.LogMessage(LogEventLevel.Verbose, "Checking input port {inputPort} with selector {portSelector} against {selector}", this, port, port.Selector, selector); + Debug.LogMessage(LogEventLevel.Verbose, this, "Checking input port {inputPort} with selector {portSelector} against {selector}", port, port.Selector, selector); return port.Selector.ToString() == selector.ToString(); }); if (inputPort == null) { - Debug.LogMessage(LogEventLevel.Verbose, "Unable to find input port for selector {selector}", this, selector); + Debug.LogMessage(LogEventLevel.Verbose, this, "Unable to find input port for selector {selector}", selector); return; } - Debug.LogMessage(LogEventLevel.Verbose, "Setting current input port to {inputPort}", this, inputPort); + Debug.LogMessage(LogEventLevel.Verbose, this, "Setting current input port to {inputPort}", inputPort); CurrentInputPort = inputPort; } catch (Exception ex) { - Debug.LogMessage(ex, "Error making switch: {Exception}", this, ex); + Debug.LogError(this, ex, "Error making switch"); } } diff --git a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj index 69f6d24e..b3c8169b 100644 --- a/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj +++ b/src/PepperDash.Essentials.Devices.Common/PepperDash.Essentials.Devices.Common.csproj @@ -29,7 +29,8 @@ - - + + + \ No newline at end of file diff --git a/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs b/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs index 0f706b7a..3dc2c709 100644 --- a/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/VideoCodec/VideoCodecBase.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharp.Reflection; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharp; using PepperDash.Core; diff --git a/src/PepperDash.Essentials/ControlSystem.cs b/src/PepperDash.Essentials/ControlSystem.cs index ddc60c09..90a04dea 100644 --- a/src/PepperDash.Essentials/ControlSystem.cs +++ b/src/PepperDash.Essentials/ControlSystem.cs @@ -92,7 +92,6 @@ namespace PepperDash.Essentials private void StartSystem(object preventInitialization) { - Debug.SetErrorLogMinimumDebugLevel(Serilog.Events.LogEventLevel.Verbose); DeterminePlatform(); @@ -241,7 +240,7 @@ namespace PepperDash.Essentials } catch (Exception e) { - Debug.LogMessage(e, "Unable to determine platform due to exception"); + Debug.LogError(e, "Unable to determine platform due to exception"); } } @@ -297,7 +296,7 @@ namespace PepperDash.Essentials } catch (Exception e) { - Debug.LogMessage(e, "FATAL INITIALIZE ERROR. System is in an inconsistent state"); + Debug.LogFatal(e, "FATAL INITIALIZE ERROR. System is in an inconsistent state"); } finally { @@ -431,7 +430,7 @@ namespace PepperDash.Essentials } catch (Exception e) { - Debug.LogMessage(e, "ERROR: Creating device {deviceKey:l}. Skipping device.",args: new[] { devConf.Key }); + Debug.LogError(e, "ERROR: Creating device {deviceKey:l}. Skipping device.",args: new[] { devConf.Key }); } } Debug.LogMessage(LogEventLevel.Information, "All Devices Loaded."); diff --git a/src/PepperDash.Essentials/PepperDash.Essentials.csproj b/src/PepperDash.Essentials/PepperDash.Essentials.csproj index d64846e5..fb31f91f 100644 --- a/src/PepperDash.Essentials/PepperDash.Essentials.csproj +++ b/src/PepperDash.Essentials/PepperDash.Essentials.csproj @@ -1,58 +1,60 @@  - - Program - Debug;Release;Debug 4.7.2 - - - PepperDash.Essentials - PepperDashEssentials - net472;net6 - true - bin\$(Configuration)\ - PepperDash Essentials - PepperDashEssentials - 2.0.0-local - $(Version) - false - - - full - - - full - - - pdbonly - - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - - - - - - + + Program + Debug;Release + + + PepperDash.Essentials + PepperDashEssentials + net472;net6.0;net8.0 + true + bin\$(Configuration)\ + PepperDash Essentials + PepperDashEssentials + 2.0.0-local + true + $(Version) + false + + + full + + + full + + + pdbonly + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + + + + + + \ No newline at end of file