serilog configuration changed based on environments
This commit is contained in:
parent
22c0d933af
commit
e8b9fe0dc3
@ -9,13 +9,25 @@ using PortBlog.API.Middleware;
|
|||||||
using Serilog;
|
using Serilog;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
|
||||||
|
|
||||||
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
if (builder.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
.MinimumLevel.Debug()
|
.MinimumLevel.Debug()
|
||||||
.WriteTo.Console()
|
.WriteTo.Console()
|
||||||
.WriteTo.File("logs/portblog.txt", rollingInterval: RollingInterval.Day)
|
.WriteTo.File("logs/portblog.txt", rollingInterval: RollingInterval.Day)
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
|
}
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
else
|
||||||
|
{
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.MinimumLevel.Information()
|
||||||
|
.WriteTo.File("logs/portblog.txt", rollingInterval: RollingInterval.Day)
|
||||||
|
.CreateLogger();
|
||||||
|
}
|
||||||
|
|
||||||
var urls = builder.Configuration.GetSection("Urls");
|
var urls = builder.Configuration.GetSection("Urls");
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user