mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-02-15 04:34:46 +00:00
feat: logging refactor
- added ability to debug by key - started on being able to switch out the websockete based on target env - added in comprehensive log methods to debug class
This commit is contained in:
@@ -1,35 +1,27 @@
|
||||
using Crestron.SimplSharp;
|
||||
using Serilog.Core;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PepperDash.Core.Logging
|
||||
{
|
||||
public class CrestronEnricher : ILogEventEnricher
|
||||
{
|
||||
static readonly string _appName;
|
||||
private static readonly string AppName;
|
||||
|
||||
static CrestronEnricher()
|
||||
{
|
||||
switch (CrestronEnvironment.DevicePlatform)
|
||||
AppName = CrestronEnvironment.DevicePlatform switch
|
||||
{
|
||||
case eDevicePlatform.Appliance:
|
||||
_appName = $"App {InitialParametersClass.ApplicationNumber}";
|
||||
break;
|
||||
case eDevicePlatform.Server:
|
||||
_appName = $"{InitialParametersClass.RoomId}";
|
||||
break;
|
||||
}
|
||||
eDevicePlatform.Appliance => $"App {InitialParametersClass.ApplicationNumber}",
|
||||
eDevicePlatform.Server => $"{InitialParametersClass.RoomId}",
|
||||
_ => string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
||||
{
|
||||
var property = propertyFactory.CreateProperty("App", _appName);
|
||||
var property = propertyFactory.CreateProperty("App", AppName);
|
||||
|
||||
logEvent.AddOrUpdateProperty(property);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user