mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
new logger
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using Serilog;
|
||||
|
||||
namespace Govor.API.Extensions;
|
||||
|
||||
public static class ConfiguratorLoggerExtensions
|
||||
{
|
||||
public static void AddLogger(this WebApplicationBuilder builder)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Information()
|
||||
.WriteTo.Console()
|
||||
.WriteTo.File("Logs/log-.txt", rollingInterval: RollingInterval.Day) // Лог в файл, ежедневно
|
||||
.CreateLogger();
|
||||
|
||||
builder.Host.UseSerilog();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
<PackageReference Include="NSwag.AspNetCore" Version="14.4.0" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.3.efcore.9.0.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="9.*" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -11,16 +11,21 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
var configuration = builder.Configuration;
|
||||
var services = builder.Services;
|
||||
|
||||
builder.AddLogger();// Serilog
|
||||
|
||||
builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowFrontend", policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:5000", "https://localhost:5000")
|
||||
/*policy.WithOrigins("http://localhost:5000", "https://localhost:5000")
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials();
|
||||
.AllowCredentials();*/
|
||||
policy.AllowAnyOrigin()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user