mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-10 10:15:01 +00:00
feat: change to use Debug.LogMessage everywhere
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
@@ -46,7 +47,7 @@ namespace PepperDash.Essentials.Core
|
||||
returnCode = CrestronDataStoreStatic.clearGlobal(key);
|
||||
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
Debug.Console(0, this, "Successfully removed secret \"{0}\"", secret);
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Successfully removed secret \"{0}\"", secret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -56,12 +57,12 @@ namespace PepperDash.Essentials.Core
|
||||
returnCode = CrestronDataStoreStatic.SetGlobalStringValue(key, secret);
|
||||
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
Debug.Console(0, this, "Successfully set secret \"{0}\"", secret);
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Successfully set secret \"{0}\"", secret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to set secret for {0}:{1} - {2}", Key, key, returnCode.ToString());
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Unable to set secret for {0}:{1} - {2}", Key, key, returnCode.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,10 +79,10 @@ namespace PepperDash.Essentials.Core
|
||||
switch (getErrorCode)
|
||||
{
|
||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
||||
Debug.Console(2, this, "Secret Successfully retrieved for {0}:{1}", Key, key);
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Secret Successfully retrieved for {0}:{1}", Key, key);
|
||||
return new CrestronSecret(key, mySecret, this);
|
||||
default:
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to retrieve secret for {0}:{1} - {2}",
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Unable to retrieve secret for {0}:{1} - {2}",
|
||||
Key, key, getErrorCode.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using PepperDash.Core;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Serilog.Events;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
@@ -47,7 +48,7 @@ namespace PepperDash.Essentials.Core
|
||||
returnCode = CrestronDataStoreStatic.clearLocal(key);
|
||||
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
Debug.Console(0, this, "Successfully removed secret \"{0}\"", secret);
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Successfully removed secret \"{0}\"", secret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -57,12 +58,12 @@ namespace PepperDash.Essentials.Core
|
||||
returnCode = CrestronDataStoreStatic.SetLocalStringValue(key, secret);
|
||||
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
Debug.Console(0, this, "Successfully set secret \"{0}\"", secret);
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Successfully set secret \"{0}\"", secret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to set secret for {0}:{1} - {2}", Key, key, returnCode.ToString());
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Unable to set secret for {0}:{1} - {2}", Key, key, returnCode.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -79,10 +80,10 @@ namespace PepperDash.Essentials.Core
|
||||
switch (getErrorCode)
|
||||
{
|
||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
||||
Debug.Console(2, this, "Secret Successfully retrieved for {0}:{1}", Key, key);
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Secret Successfully retrieved for {0}:{1}", Key, key);
|
||||
return new CrestronSecret(key, mySecret, this);
|
||||
default:
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to retrieve secret for {0}:{1} - {2}",
|
||||
Debug.LogMessage(LogEventLevel.Information, this, "Unable to retrieve secret for {0}:{1} - {2}",
|
||||
Key, key, getErrorCode.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
@@ -59,7 +60,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
if (secret == null)
|
||||
{
|
||||
Debug.Console(1, "SecretsManager unable to retrieve SecretProvider with the key '{0}'", key);
|
||||
Debug.LogMessage(LogEventLevel.Debug, "SecretsManager unable to retrieve SecretProvider with the key '{0}'", key);
|
||||
}
|
||||
return secret;
|
||||
}
|
||||
@@ -147,10 +148,10 @@ namespace PepperDash.Essentials.Core
|
||||
if (!Secrets.ContainsKey(key))
|
||||
{
|
||||
Secrets.Add(key, provider);
|
||||
Debug.Console(1, "Secrets provider '{0}' added to SecretsManager", key);
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Secrets provider '{0}' added to SecretsManager", key);
|
||||
return;
|
||||
}
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Unable to add Provider '{0}' to Secrets. Provider with that key already exists", key );
|
||||
Debug.LogMessage(LogEventLevel.Information, "Unable to add Provider '{0}' to Secrets. Provider with that key already exists", key );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -164,16 +165,16 @@ namespace PepperDash.Essentials.Core
|
||||
if (!Secrets.ContainsKey(key))
|
||||
{
|
||||
Secrets.Add(key, provider);
|
||||
Debug.Console(1, "Secrets provider '{0}' added to SecretsManager", key);
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Secrets provider '{0}' added to SecretsManager", key);
|
||||
return;
|
||||
}
|
||||
if (overwrite)
|
||||
{
|
||||
Secrets.Add(key, provider);
|
||||
Debug.Console(1, Debug.ErrorLogLevel.Notice, "Provider with the key '{0}' already exists in secrets. Overwriting with new secrets provider.", key);
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Provider with the key '{0}' already exists in secrets. Overwriting with new secrets provider.", key);
|
||||
return;
|
||||
}
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Unable to add Provider '{0}' to Secrets. Provider with that key already exists", key);
|
||||
Debug.LogMessage(LogEventLevel.Information, "Unable to add Provider '{0}' to Secrets. Provider with that key already exists", key);
|
||||
}
|
||||
|
||||
private static void SetSecretProcess(string cmd)
|
||||
@@ -274,7 +275,7 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
var secretPresent = provider.TestSecret(key);
|
||||
|
||||
Debug.Console(2, provider, "SecretsProvider {0} {1} contain a secret entry for {2}", provider.Key, secretPresent ? "does" : "does not", key);
|
||||
Debug.LogMessage(LogEventLevel.Verbose, provider, "SecretsProvider {0} {1} contain a secret entry for {2}", provider.Key, secretPresent ? "does" : "does not", key);
|
||||
|
||||
if (!secretPresent)
|
||||
return
|
||||
@@ -294,7 +295,7 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
var secretPresent = provider.TestSecret(key);
|
||||
|
||||
Debug.Console(2, provider, "SecretsProvider {0} {1} contain a secret entry for {2}", provider.Key, secretPresent ? "does" : "does not", key);
|
||||
Debug.LogMessage(LogEventLevel.Verbose, provider, "SecretsProvider {0} {1} contain a secret entry for {2}", provider.Key, secretPresent ? "does" : "does not", key);
|
||||
|
||||
if (secretPresent)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user