mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-06 00:05:05 +00:00
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// Represents a CrestronEnricher
|
|
/// </summary>
|
|
public class CrestronEnricher : ILogEventEnricher
|
|
{
|
|
static readonly string _appName;
|
|
|
|
static CrestronEnricher()
|
|
{
|
|
switch (CrestronEnvironment.DevicePlatform)
|
|
{
|
|
case eDevicePlatform.Appliance:
|
|
_appName = $"App {InitialParametersClass.ApplicationNumber}";
|
|
break;
|
|
case eDevicePlatform.Server:
|
|
_appName = $"{InitialParametersClass.RoomId}";
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Enrich method
|
|
/// </summary>
|
|
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
|
{
|
|
var property = propertyFactory.CreateProperty("App", _appName);
|
|
|
|
logEvent.AddOrUpdateProperty(property);
|
|
}
|
|
}
|
|
}
|