mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-15 20:54:46 +00:00
Adds back in crestron console print statements when running on appliance
This commit is contained in:
@@ -11,8 +11,6 @@ using PepperDash.Core.DebugThings;
|
|||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
using Serilog.Formatting.Display;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace PepperDash.Core
|
namespace PepperDash.Core
|
||||||
{
|
{
|
||||||
@@ -85,6 +83,8 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
private const int SaveTimeoutMs = 30000;
|
private const int SaveTimeoutMs = 30000;
|
||||||
|
|
||||||
|
private static bool _runningOnAppliance = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version for the currently loaded PepperDashCore dll
|
/// Version for the currently loaded PepperDashCore dll
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -104,7 +104,7 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
static Debug()
|
static Debug()
|
||||||
{
|
{
|
||||||
_consoleLoggingLevelSwitch = new LoggingLevelSwitch();
|
_consoleLoggingLevelSwitch = new LoggingLevelSwitch(initialMinimumLevel: LogEventLevel.Information);
|
||||||
_websocketLoggingLevelSwitch = new LoggingLevelSwitch();
|
_websocketLoggingLevelSwitch = new LoggingLevelSwitch();
|
||||||
|
|
||||||
// Instantiate the root logger
|
// Instantiate the root logger
|
||||||
@@ -218,6 +218,8 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
if (programEventType == eProgramStatusEventType.Stopping)
|
if (programEventType == eProgramStatusEventType.Stopping)
|
||||||
{
|
{
|
||||||
|
_logger.CloseAndFlush();
|
||||||
|
|
||||||
if (_saveTimer != null)
|
if (_saveTimer != null)
|
||||||
{
|
{
|
||||||
_saveTimer.Stop();
|
_saveTimer.Stop();
|
||||||
@@ -430,11 +432,6 @@ namespace PepperDash.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void Log(uint level, string format, params object[] items)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prints message to console if current debug level is equal to or higher than the level of this message.
|
/// Prints message to console if current debug level is equal to or higher than the level of this message.
|
||||||
/// Uses CrestronConsole.PrintLine.
|
/// Uses CrestronConsole.PrintLine.
|
||||||
@@ -454,8 +451,13 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
_logger.Write((LogEventLevel)level, format, items);
|
_logger.Write((LogEventLevel)level, format, items);
|
||||||
|
|
||||||
//CrestronConsole.PrintLine("[{0}]App {1}:{2}", DateTime.Now.ToString("HH:mm:ss.fff"), InitialParametersClass.ApplicationNumber,
|
if (_runningOnAppliance)
|
||||||
// string.Format(format, items));
|
{
|
||||||
|
CrestronConsole.PrintLine("[{0}]App {1} Lvl {2}:{3}", DateTime.Now.ToString("HH:mm:ss.fff"),
|
||||||
|
InitialParametersClass.ApplicationNumber,
|
||||||
|
level,
|
||||||
|
string.Format(format, items));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -467,8 +469,8 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
log.Write((LogEventLevel)level, format, items);
|
log.Write((LogEventLevel)level, format, items);
|
||||||
|
|
||||||
//if (Level >= level)
|
if (Level >= level)
|
||||||
// Console(level, "[{0}] {1}", dev.Key, string.Format(format, items));
|
Console(level, "[{0}] {1}", dev.Key, string.Format(format, items));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -490,10 +492,10 @@ namespace PepperDash.Core
|
|||||||
|
|
||||||
log.Write((LogEventLevel)level, format, items);
|
log.Write((LogEventLevel)level, format, items);
|
||||||
|
|
||||||
//if (Level >= level)
|
if (Level >= level)
|
||||||
//{
|
{
|
||||||
// Console(level, str);
|
Console(level, str);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -546,7 +548,7 @@ namespace PepperDash.Core
|
|||||||
public static void LogError(ErrorLogLevel errorLogLevel, string str)
|
public static void LogError(ErrorLogLevel errorLogLevel, string str)
|
||||||
{
|
{
|
||||||
|
|
||||||
var msg = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance ? string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str) : string.Format("Room {0}:{1}", InitialParametersClass.RoomId, str);
|
var msg = _runningOnAppliance ? string.Format("App {0}:{1}", InitialParametersClass.ApplicationNumber, str) : string.Format("Room {0}:{1}", InitialParametersClass.RoomId, str);
|
||||||
switch (errorLogLevel)
|
switch (errorLogLevel)
|
||||||
{
|
{
|
||||||
case ErrorLogLevel.Error:
|
case ErrorLogLevel.Error:
|
||||||
|
|||||||
Reference in New Issue
Block a user