Skip to content

Commit

Permalink
Add log enrichment
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Oct 6, 2024
1 parent e3563c9 commit 4c370fc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions ProjectTemplates/ShinyApp/Infrastructure/AppLogEnricher.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Microsoft.Extensions.Diagnostics.Enrichment;

namespace ShinyApp.Infrastructure;


public class AppLogEnricher(
// IAuthenticationService auth,
IAppInfo appInfo,
IDeviceDisplay display,
IDeviceInfo device
) : ILogEnricher
{
public void Enrich(IEnrichmentTagCollector collector)
{
// if (auth.Identity != null)
// collector.Add("UserId", auth.Identity.UserId);

collector.Add("AppVersion", appInfo.VersionString);
collector.Add("AppBuild", appInfo.BuildString);
collector.Add("DeviceManufacturer", device.Manufacturer);
collector.Add("DeviceModel", device.Model);
collector.Add("DeviceName", device.Name);
collector.Add("DeviceType", device.DeviceType);
collector.Add("DeviceVersion", device.Version);
collector.Add("DisplayOrientation", display.MainDisplayInfo.Orientation);
collector.Add("DisplayScale", display.MainDisplayInfo.Density);
collector.Add("DisplayWidth", display.MainDisplayInfo.Width);
collector.Add("DisplayHeight", display.MainDisplayInfo.Height);
}
}
2 changes: 1 addition & 1 deletion Template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Shiny.NET Templates - One stop shop to setup almost everything you can imagine within your .NET MAUI application</Description>
<PackageType>Template</PackageType>
<PackageVersion>2.64.0</PackageVersion>
<PackageVersion>2.64.1</PackageVersion>
<PackageId>Shiny.Templates</PackageId>
<Title>Shiny Templates</Title>
<Authors>Allan Ritchie</Authors>
Expand Down

0 comments on commit 4c370fc

Please sign in to comment.