mirror of
https://github.com/PepperDash/PepperDashCore.git
synced 2026-01-11 19:44:44 +00:00
29 lines
856 B
C#
29 lines
856 B
C#
using Crestron.SimplSharp;
|
|
using Serilog.Core;
|
|
using Serilog.Events;
|
|
|
|
namespace PepperDash.Core.Logging
|
|
{
|
|
public class CrestronEnricher : ILogEventEnricher
|
|
{
|
|
private static readonly string AppName;
|
|
|
|
static CrestronEnricher()
|
|
{
|
|
AppName = CrestronEnvironment.DevicePlatform switch
|
|
{
|
|
eDevicePlatform.Appliance => $"APP{InitialParametersClass.ApplicationNumber.ToString().PadLeft(2, '0')}",
|
|
eDevicePlatform.Server => $"{InitialParametersClass.RoomId}",
|
|
_ => string.Empty
|
|
};
|
|
}
|
|
|
|
|
|
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
|
{
|
|
var property = propertyFactory.CreateProperty("App", AppName);
|
|
logEvent.AddOrUpdateProperty(property);
|
|
}
|
|
}
|
|
}
|