Updated
This commit is contained in:
@@ -2,11 +2,17 @@ using EonaCat.Logger;
|
||||
using EonaCat.Logger.EonaCatCoreLogger;
|
||||
using EonaCat.Logger.EonaCatCoreLogger.Extensions;
|
||||
using EonaCat.Logger.EonaCatCoreLogger.Models;
|
||||
using EonaCat.Logger.LogClient;
|
||||
using EonaCat.Logger.Managers;
|
||||
using EonaCat.Logger.Test.Web;
|
||||
using EonaCat.MemoryGuard;
|
||||
using EonaCat.Versioning.Helpers;
|
||||
using EonaCat.Web.RateLimiter;
|
||||
using EonaCat.Web.RateLimiter.Endpoints.Extensions;
|
||||
using Logger = EonaCat.Logger.Logger;
|
||||
using LogLevel = EonaCat.Logger.LogClient.LogLevel;
|
||||
|
||||
MemoryGuard.StartDevelopment();
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
int onLogCounter = 0;
|
||||
@@ -26,6 +32,26 @@ logger.LoggerSettings.LogTraffic();
|
||||
logger.LoggerSettings.OnLog += LoggerSettings_OnLog;
|
||||
logger.LoggerSettings.UseMask = true;
|
||||
|
||||
// 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);
|
||||
|
||||
// Now all EonaCat.Logger logs will be sent to LogCentral automatically
|
||||
await logger.LogAsync("This is a test log message sent to LogCentral!", ELogType.INFO).ConfigureAwait(false);
|
||||
|
||||
Console.WriteLine(DllInfo.EonaCatVersion);
|
||||
Console.WriteLine(VersionHelper.GetInformationalVersion());
|
||||
|
||||
@@ -143,8 +169,8 @@ void RunLoggingExceptionTests()
|
||||
loggerSettings.UseLocalTime = true;
|
||||
loggerSettings.Id = "TEST";
|
||||
loggerSettings.TypesToLog.Add(ELogType.INFO);
|
||||
var logger = new LogManager(loggerSettings);
|
||||
|
||||
var logger = new LogManager(loggerSettings);
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
try
|
||||
@@ -161,6 +187,7 @@ void RunLoggingExceptionTests()
|
||||
}
|
||||
}
|
||||
|
||||
await Task.Run(RunMemoryReportTask).ConfigureAwait(false);
|
||||
await Task.Run(RunMaskTest).ConfigureAwait(false);
|
||||
await Task.Run(RunWebLoggerTestsAsync).ConfigureAwait(false);
|
||||
await Task.Run(RunWebLoggingTests).ConfigureAwait(false);
|
||||
@@ -168,6 +195,16 @@ await Task.Run(RunLoggingTestsAsync).ConfigureAwait(false);
|
||||
await Task.Run(RunLoggingExceptionTests).ConfigureAwait(false);
|
||||
await Task.Run(RunWebLoggingExceptionTests).ConfigureAwait(false);
|
||||
|
||||
async void RunMemoryReportTask()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
await MemoryGuard.PrintReportAsync().ConfigureAwait(false);
|
||||
await Task.Delay(60000).ConfigureAwait(false);
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
|
||||
void RunWebLoggingExceptionTests()
|
||||
{
|
||||
for (var i = 0; i < 10; i++)
|
||||
|
||||
Reference in New Issue
Block a user