mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 03:57:27 +00:00
feat: move PD Core into Essentials
This commit is contained in:
parent
cdafaf7586
commit
26116d0495
84 changed files with 16472 additions and 5 deletions
37
src/PepperDash.Core/Logging/CrestronEnricher.cs
Normal file
37
src/PepperDash.Core/Logging/CrestronEnricher.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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;
|
||||
|
||||
static CrestronEnricher()
|
||||
{
|
||||
switch (CrestronEnvironment.DevicePlatform)
|
||||
{
|
||||
case eDevicePlatform.Appliance:
|
||||
_appName = $"App {InitialParametersClass.ApplicationNumber}";
|
||||
break;
|
||||
case eDevicePlatform.Server:
|
||||
_appName = $"{InitialParametersClass.RoomId}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
|
||||
{
|
||||
var property = propertyFactory.CreateProperty("App", _appName);
|
||||
|
||||
logEvent.AddOrUpdateProperty(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue