feat: change to use Debug.LogMessage everywhere

This commit is contained in:
Andrew Welker
2024-03-21 13:44:08 -05:00
parent 4d0e3b1943
commit ee4ccb0d1a
110 changed files with 1033 additions and 988 deletions

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.SmartObjects
@@ -47,12 +48,12 @@ namespace PepperDash.Essentials.Core.SmartObjects
var c = Count;
NameSigOffset = nameSigOffset;
MaxCount = SmartObject.BooleanOutput.Count(s => s.Name.EndsWith("Pressed"));
//Debug.Console(2, "Smart object {0} has {1} max", so.ID, MaxCount);
//Debug.LogMessage(LogEventLevel.Verbose, "Smart object {0} has {1} max", so.ID, MaxCount);
}
catch
{
var msg = string.Format("SmartObjectDynamicList: Smart Object {0:X2}-{1} is not a dynamic list. Ignoring", so.Device.ID, so.ID);
Debug.Console(0, Debug.ErrorLogLevel.Error, msg);
Debug.LogMessage(LogEventLevel.Information, msg);
}
}
@@ -72,7 +73,7 @@ namespace PepperDash.Essentials.Core.SmartObjects
//}
//catch(Exception e)
//{
// Debug.Console(1, "Cannot set Dynamic List item {0} on smart object {1}", index, SmartObject.ID);
// Debug.LogMessage(LogEventLevel.Debug, "Cannot set Dynamic List item {0} on smart object {1}", index, SmartObject.ID);
// ErrorLog.Warn(e.ToString());
//}
}
@@ -120,7 +121,7 @@ namespace PepperDash.Essentials.Core.SmartObjects
/// </summary>
public void ClearActions()
{
Debug.Console(2, "SO CLEAR");
Debug.LogMessage(LogEventLevel.Verbose, "SO CLEAR");
for(ushort i = 1; i <= MaxCount; i++)
SmartObject.BooleanOutput[string.Format("Item {0} Pressed", i)].UserObject = null;
}

View File

@@ -7,6 +7,7 @@ using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core.SmartObjects
{
@@ -45,7 +46,7 @@ namespace PepperDash.Essentials.Core.SmartObjects
if (SmartObject.BooleanOutput.Contains(name))
return SmartObject.BooleanOutput[name];
else
Debug.Console(0, "WARNING: Cannot get signal. Smart object {0} on trilist {1:x2} does not contain signal '{2}'",
Debug.LogMessage(LogEventLevel.Information, "WARNING: Cannot get signal. Smart object {0} on trilist {1:x2} does not contain signal '{2}'",
SmartObject.ID, SmartObject.Device.ID, name);
return null;
}
@@ -61,7 +62,7 @@ namespace PepperDash.Essentials.Core.SmartObjects
SmartObject.BooleanOutput[name].UserObject = a;
else
{
Debug.Console(0, "WARNING: Cannot set action. Smart object {0} on trilist {1:x2} does not contain signal '{2}'",
Debug.LogMessage(LogEventLevel.Information, "WARNING: Cannot set action. Smart object {0} on trilist {1:x2} does not contain signal '{2}'",
SmartObject.ID, SmartObject.Device.ID, name);
}
}

View File

@@ -83,7 +83,7 @@
// // Handler to route source changes into list feedback
// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args)
// {
// Debug.Console(2, "SRL received source change");
// Debug.LogMessage(LogEventLevel.Verbose, "SRL received source change");
// ClearPresentationSourceFb(args.OldSource);
// SetPresentationSourceFb(args.NewSource);
// }
@@ -131,7 +131,7 @@
// // Should be able to see if there is not enough buttons right here
// if (nameSig == null)
// {
// Debug.Console(0, "ERROR: Item {0} does not exist on source list SRL", index);
// Debug.LogMessage(LogEventLevel.Information, "ERROR: Item {0} does not exist on source list SRL", index);
// return;
// }
// nameSig.StringValue = srcDevice.Name;
@@ -148,7 +148,7 @@
// var status = videoDev.GetVideoStatuses();
// if (status != null)
// {
// Debug.Console(1, "Linking {0} video status to SRL", videoDev.Key);
// Debug.LogMessage(LogEventLevel.Debug, "Linking {0} video status to SRL", videoDev.Key);
// videoDev.GetVideoStatuses().VideoSyncFeedback.LinkInputSig(owner.BoolInputSig(index, 3));
// }
// }

View File

@@ -9,6 +9,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
using PepperDash.Core;
using Serilog.Events;
namespace PepperDash.Essentials.Core
@@ -53,7 +54,7 @@ namespace PepperDash.Essentials.Core
// Fail cleanly if not defined
if (triList.SmartObjects == null || triList.SmartObjects.Count == 0)
{
Debug.Console(0, "TriList {0:X2} Smart objects have not been loaded", triList.ID, smartObjectId);
Debug.LogMessage(LogEventLevel.Information, "TriList {0:X2} Smart objects have not been loaded", triList.ID, smartObjectId);
return;
}
if (triList.SmartObjects.TryGetValue(smartObjectId, out obj))
@@ -68,13 +69,13 @@ namespace PepperDash.Essentials.Core
// Count the enable lines to see what max items is
MaxDefinedItems = (ushort)SRL.BooleanInput
.Where(s => s.Name.Contains("Enable")).Count();
Debug.Console(2, "SRL {0} contains max {1} items", SRL.ID, MaxDefinedItems);
Debug.LogMessage(LogEventLevel.Verbose, "SRL {0} contains max {1} items", SRL.ID, MaxDefinedItems);
SRL.SigChange -= new SmartObjectSigChangeEventHandler(SRL_SigChange);
SRL.SigChange += new SmartObjectSigChangeEventHandler(SRL_SigChange);
}
else
Debug.Console(0, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded",
Debug.LogMessage(LogEventLevel.Information, "ERROR: TriList 0x{0:X2} Cannot load smart object {1}. Verify correct SGD file is loaded",
triList.ID, smartObjectId);
}