Added EonaCat.LogStack.Status

Updated EonaCat.LogStack.LogClient to support EonaCat.LogStack.Status
This commit is contained in:
2026-03-12 21:15:33 +01:00
parent 776cc624bd
commit 977374ce02
41 changed files with 3412 additions and 180 deletions

View File

@@ -1,8 +1,4 @@
using EonaCat.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using System;
namespace EonaCat.LogStack.LogClient.Models
{
@@ -11,57 +7,15 @@ namespace EonaCat.LogStack.LogClient.Models
public class LogEntry
{
public string Id { get; set; } = Guid.NewGuid().ToString();
public DateTime Timestamp { get; set; }
public string ApplicationName { get; set; } = default!;
public string ApplicationVersion { get; set; } = default!;
public string Environment { get; set; } = default!;
public string MachineName { get; set; } = default!;
public int Level { get; set; }
public string Category { get; set; } = default!;
public string Message { get; set; } = default!;
public int Id { get; set; }
public string Source { get; set; } = "system";
public string Level { get; set; } = "info";
public string Message { get; set; } = "";
public string? Properties { get; set; }
public string? Exception { get; set; }
public string? StackTrace { get; set; }
[Column(TypeName = "TEXT")]
public string? PropertiesJson { get; set; }
[NotMapped]
public Dictionary<string, object>? Properties
{
get => string.IsNullOrEmpty(PropertiesJson)
? null
: JsonHelper.ToObject<Dictionary<string, object>>(PropertiesJson);
set => PropertiesJson = value == null ? null : JsonHelper.ToJson(value);
}
public string? UserId { get; set; }
public string? SessionId { get; set; }
public string? RequestId { get; set; }
public string? CorrelationId { get; set; }
public static LogEntryDto ToDto(LogEntry entry) => new LogEntryDto()
{
Id = entry.Id,
Timestamp = entry.Timestamp,
ApplicationName = entry.ApplicationName,
ApplicationVersion = entry.ApplicationVersion,
Environment = entry.Environment,
MachineName = entry.MachineName,
Level = entry.Level,
Category = entry.Category,
Message = entry.Message,
Exception = entry.Exception,
StackTrace = entry.StackTrace,
Properties = entry.Properties,
UserId = entry.UserId,
SessionId = entry.SessionId,
RequestId = entry.RequestId,
CorrelationId = entry.CorrelationId
};
public DateTime Timestamp { get; set; } = DateTime.UtcNow;
public string? TraceId { get; set; }
public string? Host { get; set; }
}
}