Updated
This commit is contained in:
parent
ad04608e29
commit
6f7e75536f
|
@ -1,12 +1,14 @@
|
|||
using EonaCat.Logger;
|
||||
using EonaCat.Logger.Extensions;
|
||||
using EonaCat.Logger.Managers;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Logging.AddEonaCatFileLogger();
|
||||
FileLoggerOptions options = new FileLoggerOptions();
|
||||
options.MaxRolloverFiles = 5;
|
||||
options.FileSizeLimit = 1 * 1024 * 1024 / 4;
|
||||
builder.Logging.AddEonaCatFileLogger(fileLoggerOptions: options, filenamePrefix:"web");
|
||||
builder.Services.AddRazorPages();
|
||||
|
||||
var app = builder.Build();
|
||||
|
@ -28,14 +30,9 @@ app.UseAuthorization();
|
|||
|
||||
app.MapRazorPages();
|
||||
|
||||
Task.Run(RunLoggingTests);
|
||||
|
||||
Task.Run(RunLoggingExceptionTests);
|
||||
|
||||
void RunLoggingExceptionTests()
|
||||
{
|
||||
var loggerSettings = new LoggerSettings();
|
||||
loggerSettings.FileLoggerOptions.BackgroundQueueSize = 100;
|
||||
var logger = new LogManager(loggerSettings);
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
|
@ -54,8 +51,9 @@ void RunLoggingExceptionTests()
|
|||
}
|
||||
|
||||
Task.Run(RunWebLoggingTests);
|
||||
|
||||
Task.Run(RunWebLoggingExeptionTests);
|
||||
//Task.Run(RunLoggingTests);
|
||||
//Task.Run(RunLoggingExceptionTests);
|
||||
//Task.Run(RunWebLoggingExeptionTests);
|
||||
|
||||
void RunWebLoggingExeptionTests()
|
||||
{
|
||||
|
@ -76,9 +74,10 @@ void RunWebLoggingExeptionTests()
|
|||
|
||||
void RunWebLoggingTests()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 9000000; i++)
|
||||
{
|
||||
app.Logger.LogInformation($"web-test {i}");
|
||||
File.AppendAllText("C:\\workdir\\EonaCat.Testers\\EonaCat.Logger.Web\\EonaCat.Logger.Web\\bin\\Debug\\net6.0\\logs\\test.log",$"WebLogged: {i}{Environment.NewLine}");
|
||||
Console.WriteLine($"WebLogged: {i}");
|
||||
Task.Delay(1);
|
||||
}
|
||||
|
@ -87,7 +86,6 @@ void RunWebLoggingTests()
|
|||
void RunLoggingTests()
|
||||
{
|
||||
var loggerSettings = new LoggerSettings();
|
||||
loggerSettings.FileLoggerOptions.BackgroundQueueSize = 100;
|
||||
var logger = new LogManager(loggerSettings);
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
|
|
Loading…
Reference in New Issue