feat: add Launcher Next .NET 8 foundation
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
using System.Text.Json;
|
||||
using Launcher.Next.Core;
|
||||
namespace Launcher.Next.Observability;
|
||||
public sealed class JsonlTelemetry(string logRoot) : ILauncherTelemetry
|
||||
{
|
||||
public void Write(string eventType, IReadOnlyDictionary<string, object?>? fields = null)
|
||||
{ try { Directory.CreateDirectory(logRoot); var allowed = (fields ?? new Dictionary<string, object?>()).Where(x => !x.Key.Contains("user", StringComparison.OrdinalIgnoreCase) && !x.Key.Contains("token", StringComparison.OrdinalIgnoreCase) && !x.Key.Contains("password", StringComparison.OrdinalIgnoreCase)).ToDictionary(); var line = JsonSerializer.Serialize(new { Timestamp = DateTimeOffset.UtcNow, EventType = eventType, Fields = allowed }); File.AppendAllText(Path.Combine(logRoot, DateTime.UtcNow.ToString("yyyyMMdd") + ".jsonl"), line + Environment.NewLine); } catch { } }
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk"><ItemGroup><ProjectReference Include="..\Launcher.Next.Core\Launcher.Next.Core.csproj" /></ItemGroup></Project>
|
||||
Reference in New Issue
Block a user