chore: update some logging methods

This commit is contained in:
Andrew Welker
2025-03-25 23:58:51 -05:00
parent 26116d0495
commit a5bc79c469
7 changed files with 12 additions and 7 deletions

View File

@@ -741,7 +741,7 @@ namespace PepperDash.Core
{
if (HeartbeatEnabled)
{
Debug.Console(2, this, "Starting Heartbeat");
this.LogVerbose("Starting Heartbeat");
if (HeartbeatSendTimer == null)
{

View File

@@ -686,7 +686,7 @@ namespace PepperDash.Core
}
catch (Exception e)
{
this.LogException(ex, "DequeueEvent error");
this.LogException(e, "DequeueEvent error");
}
// Make sure to leave the CCritical section in case an exception above stops this thread, or we won't be able to restart it.
if (DequeueLock != null)

View File

@@ -17,6 +17,7 @@ using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
@@ -445,7 +446,7 @@ namespace PepperDash.Core
/// </summary>
public void Disconnect()
{
Debug.Console(2, "Disconnect Called");
this.LogVerbose("Disconnect Called");
DisconnectCalledByUser = true;
if (IsConnected)

View File

@@ -15,6 +15,7 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
@@ -526,7 +527,7 @@ namespace PepperDash.Core
{
SocketErrorCodes error = myTcpServer.SendDataAsync(i, b, b.Length, (x, y, z) => { });
if (error != SocketErrorCodes.SOCKET_OK && error != SocketErrorCodes.SOCKET_OPERATION_PENDING)
Debug.Console(2, error.ToString());
this.LogError("{error}",error.ToString());
}
}
}

View File

@@ -6,6 +6,7 @@ using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronSockets;
using Newtonsoft.Json;
using PepperDash.Core.Logging;
namespace PepperDash.Core
{
@@ -279,7 +280,7 @@ namespace PepperDash.Core
}
catch (Exception ex)
{
Debug.Console(0, "GenericUdpServer Receive error: {0}{1}", ex.Message, ex.StackTrace);
this.LogException(ex, "GenericUdpServer Receive error");
}
finally
{

View File

@@ -1,5 +1,6 @@
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Serilog.Events;
namespace PepperDash.Core
{
@@ -43,7 +44,7 @@ namespace PepperDash.Core
{
var status = CrestronEthernetHelper.GetEthernetParameter(
CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_LINK_STATUS, 0);
Debug.Console(0, "LinkActive = {0}", status);
Debug.LogMessage(LogEventLevel.Information, "LinkActive = {0}", status);
return status == "";
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Serilog.Events;
//using PepperDash.Core;
@@ -30,7 +31,7 @@ namespace PepperDash.Core.JsonToSimpl
if (string.IsNullOrEmpty(master.UniqueID))
throw new InvalidOperationException("JSON Master cannot be added with a null UniqueId");
Debug.Console(1, "JSON Global adding master {0}", master.UniqueID);
Debug.LogMessage(LogEventLevel.Debug, "JSON Global adding master {0}", master.UniqueID);
if (Masters.Contains(master)) return;