mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-11 10:44:49 +00:00
fix: update logging format to include key
This commit is contained in:
@@ -20,19 +20,21 @@ namespace PepperDash.Core
|
||||
|
||||
public void Emit(LogEvent logEvent)
|
||||
{
|
||||
if (!Debug.IsRunningOnAppliance) return;
|
||||
if (!Debug.IsRunningOnAppliance) return;
|
||||
|
||||
CrestronConsole.PrintLine("[{0}][App {1}][Lvl {2}]: {3}", logEvent.Timestamp,
|
||||
InitialParametersClass.ApplicationNumber,
|
||||
logEvent.Level,
|
||||
logEvent.RenderMessage());
|
||||
string message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}]{logEvent.RenderMessage()}";
|
||||
|
||||
if(logEvent.Properties.TryGetValue("Key",out var value) && value is ScalarValue sv && sv.Value is string rawValue)
|
||||
{
|
||||
message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}][{rawValue}]: {logEvent.RenderMessage()}";
|
||||
}
|
||||
|
||||
CrestronConsole.PrintLine(message);
|
||||
}
|
||||
|
||||
public DebugConsoleSink(ITextFormatter formatProvider)
|
||||
public DebugConsoleSink(ITextFormatter formatProvider )
|
||||
{
|
||||
|
||||
_textFormatter = formatProvider ?? new JsonFormatter();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user