feat: add method to log Exceptions using default Serilog options

Alos modified console sink to pad non-keyed messages with 3 characters of empty space
This commit is contained in:
Andrew Welker
2024-03-27 11:49:04 -05:00
parent f2f40c7197
commit 99d0b2ea3a
3 changed files with 45 additions and 19 deletions

View File

@@ -5,12 +5,7 @@ using Serilog.Core;
using Serilog.Events;
using Serilog.Formatting;
using Serilog.Formatting.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Core
{
@@ -26,7 +21,7 @@ namespace PepperDash.Core
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()}";
message = $"[{logEvent.Timestamp}][{logEvent.Level}][App {InitialParametersClass.ApplicationNumber}][{rawValue,3}]: {logEvent.RenderMessage()}";
}
CrestronConsole.PrintLine(message);