Merge pull request #8 in PEC/pepperdash-simplsharp-core from feature/debug to master

* commit 'b94ebe082d099ef6cc0a4ec88b55c7571f898a17':
  Added timestamp to debug console messages
  Minor updates to tcp client
This commit is contained in:
Heath Volmer
2017-11-20 13:13:47 -05:00
3 changed files with 114 additions and 110 deletions

View File

@@ -307,7 +307,8 @@ namespace PepperDash.Core
{
//if (Debug.Level == 2)
// Debug.Console(2, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
Client.SendData(bytes, bytes.Length);
if(Client != null)
Client.SendData(bytes, bytes.Length);
}

View File

@@ -39,11 +39,13 @@ namespace PepperDash.Core
Key = key;
if (key.Contains('.')) Debug.Console(0, this, "WARNING: Device name's should not include '.'");
Name = "";
}
public Device(string key, string name) : this(key)
{
Name = name;
}
//public Device(DeviceConfig config)
@@ -105,5 +107,6 @@ namespace PepperDash.Core
{
if (o is bool && !(bool)o) a();
}
}
}

View File

@@ -138,7 +138,7 @@ namespace PepperDash.Core
public static void Console(uint level, string format, params object[] items)
{
if (Level >= level)
CrestronConsole.PrintLine("App {0}:{1}", InitialParametersClass.ApplicationNumber,
CrestronConsole.PrintLine("[{0}]App {1}:{2}", DateTime.Now.ToString("HH:mm:ss.fff"), InitialParametersClass.ApplicationNumber,
string.Format(format, items));
}