This commit is contained in:
EonaCat 2023-01-14 15:57:27 +01:00
parent c503567a94
commit 4050af9902
3 changed files with 28 additions and 5 deletions

View File

@ -6,6 +6,11 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="EonaCat.Web.Tracer" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="EonaCat.Logger"> <Reference Include="EonaCat.Logger">
<HintPath>..\..\..\EonaCat.Logger\EonaCat.Logger\bin\Debug\netstandard2.0\EonaCat.Logger.dll</HintPath> <HintPath>..\..\..\EonaCat.Logger\EonaCat.Logger\bin\Debug\netstandard2.0\EonaCat.Logger.dll</HintPath>

View File

@ -1,14 +1,18 @@
using EonaCat.Logger; using EonaCat.Logger;
using EonaCat.Logger.Extensions; using EonaCat.Logger.Extensions;
using EonaCat.Logger.Managers; using EonaCat.Logger.Managers;
using EonaCat.Web.Tracer;
using EonaCat.Web.Tracer.Extensions;
using System.Diagnostics;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
FileLoggerOptions options = new FileLoggerOptions(); //FileLoggerOptions options = new FileLoggerOptions();
options.MaxRolloverFiles = 5; //options.MaxRolloverFiles = 5;
options.FileSizeLimit = 1 * 1024 * 1024 / 4; //options.FileSizeLimit = 1 * 1024 * 1024 / 4;
builder.Logging.AddEonaCatFileLogger(fileLoggerOptions: options, filenamePrefix:"web"); //builder.Logging.AddEonaCatFileLogger(fileLoggerOptions: options, filenamePrefix:"web");
builder.Services.AddRazorPages(); builder.Services.AddRazorPages();
var app = builder.Build(); var app = builder.Build();
@ -21,6 +25,15 @@ if (!app.Environment.IsDevelopment())
app.UseHsts(); app.UseHsts();
} }
WebTracer.OnLog += WebTracer_OnLog;
void WebTracer_OnLog(object? sender, string e)
{
Console.WriteLine(e);
}
app.UseWebTracer();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseStaticFiles(); app.UseStaticFiles();
@ -50,7 +63,7 @@ void RunLoggingExceptionTests()
} }
} }
Task.Run(RunWebLoggingTests); //Task.Run(RunWebLoggingTests);
//Task.Run(RunLoggingTests); //Task.Run(RunLoggingTests);
//Task.Run(RunLoggingExceptionTests); //Task.Run(RunLoggingExceptionTests);
//Task.Run(RunWebLoggingExeptionTests); //Task.Run(RunWebLoggingExeptionTests);

View File

@ -0,0 +1,5 @@
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": []
}