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

@@ -7,6 +7,8 @@ using EonaCat.LogStack.LogClient;
using EonaCat.Web.RateLimiter;
using EonaCat.Web.RateLimiter.Endpoints.Extensions;
using EonaCat.LogStack.Flows.WindowsEventLog;
using EonaCat.LogStack.LogClient.Models;
using EonaCat.LogStack.Extensions;
namespace EonaCat.LogStack.Test.Web
{
@@ -14,6 +16,31 @@ namespace EonaCat.LogStack.Test.Web
{
public static async Task Main(string[] args)
{
// Configure the client
var centralOptions = new LogCentralOptions
{
ServerUrl = "https://localhost:62299",
ApiKey = "716a964de381979df4303bf93fc091d3",
ApplicationName = "MyApp",
ApplicationVersion = "1.0.0",
Environment = "Production",
FlushIntervalSeconds = 5
};
var logClient = new LogCentralClient(centralOptions);
logClient.LogAsync(new LogEntry
{
Timestamp = DateTime.UtcNow,
Level = Core.LogLevel.Critical.ToString(),
Message = "Hello, LogCentral!",
Properties = new Dictionary<string, object>
{
{ "UserId", 123 },
{ "Operation", "TestLogging" }
}.ToJson()
}).ConfigureAwait(false);
Console.ReadKey();
_ = Task.Run(async () =>
{
var logBuilder = new LogBuilder();
@@ -35,7 +62,7 @@ namespace EonaCat.LogStack.Test.Web
//logBuilder.WriteToSignalR();
//logBuilder.WriteToEmailFlow();
//logBuilder.WriteToWindowsEventLog();
logBuilder.WriteToHttp("https://localhost:62299/api/logs/eonacat");
var logger = logBuilder.Build();
logger.AddModifier((ref LogEventBuilder b) =>
@@ -142,20 +169,6 @@ namespace EonaCat.LogStack.Test.Web
//logger.LoggerSettings.HeaderTokens.AddCustomToken("AppName", x => "[ALL YOUR BASE ARE BELONG TO US!]");
//logger.LoggerSettings.HeaderFormat = "{AppName} {logtype} {ts}";
// Configure the client
var centralOptions = new LogCentralOptions
{
ServerUrl = "https://localhost:7282",
ApiKey = "716a964de381979df4303bf93fc091d3",
ApplicationName = "MyApp",
ApplicationVersion = "1.0.0",
Environment = "Production",
BatchSize = 50,
FlushIntervalSeconds = 5
};
var logClient = new LogCentralClient(centralOptions);
// Create the adapter
//var adapter = new LogCentralEonaCatAdapter(logger.LoggerSettings, logClient);
//await LogManager.Instance.WriteAsync("LogCentral adapter initialized", ELogType.INFO).ConfigureAwait(false);