feat: Moving environment to 3 properties for Framework, Series, and Runtime

This commit is contained in:
Drew Tingen
2021-01-12 14:56:09 -05:00
committed by Chris Cameron
parent 68365553ed
commit 237b5d3e86
9 changed files with 127 additions and 150 deletions

View File

@@ -160,28 +160,26 @@ namespace ICD.Common.Utils
if (args.Length > 0)
message = string.Format(message, args);
switch (IcdEnvironment.RuntimeEnvironment)
if (IcdEnvironment.Framework == IcdEnvironment.eFramework.Standard)
{
case IcdEnvironment.eRuntimeEnvironment.Standard:
// Prepend the exception type, append the stack trace
if (exception != null)
message = string.Format("{0}: {1}{2}{3}",
exception.GetType().Name,
message,
IcdEnvironment.NewLine,
exception.StackTrace);
// Prepend the exception type, append the stack trace
if (exception != null)
message = string.Format("{0}: {1}{2}{3}",
exception.GetType().Name,
message,
IcdEnvironment.NewLine,
exception.StackTrace);
// Prefix severity and time
string fixedSeverity = severity.Substring(0, Math.Min(6, severity.Length));
fixedSeverity = string.Format("{0,-6}", fixedSeverity);
message = string.Format("{0} - {1} - {2}", fixedSeverity, IcdEnvironment.GetLocalTime(), message);
break;
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
// Add an extra newline
message += IcdEnvironment.NewLine;
break;
// Prefix severity and time
string fixedSeverity = severity.Substring(0, Math.Min(6, severity.Length));
fixedSeverity = string.Format("{0,-6}", fixedSeverity);
message = string.Format("{0} - {1} - {2}", fixedSeverity, IcdEnvironment.GetLocalTime(), message);
}
// Add an extra newline for 4-series to help formatting
else if(IcdEnvironment.CrestronSeries == IcdEnvironment.eCrestronSeries.FourSeries)
message += IcdEnvironment.NewLine;
// Color formatting
return s_SeverityToColor[severity].FormatAnsi(message);