Don't spam the log with debug info
This commit is contained in:
@@ -17,16 +17,7 @@ internal class Program
|
|||||||
// add option to sort by nzb age
|
// add option to sort by nzb age
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
var configuration = builder.Configuration;
|
var configuration = builder.Configuration;
|
||||||
|
ConfigureLogger(configuration);
|
||||||
// TODO workaround to not log api keys
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
|
||||||
.ReadFrom.Configuration(configuration)
|
|
||||||
.WriteTo.Console(outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")
|
|
||||||
.Filter.ByExcluding(Matching.FromSource("System.Net.Http.HttpClient"))
|
|
||||||
.Filter.ByExcluding(Matching.FromSource("Microsoft.Extensions.Http.DefaultHttpClientFactory"))
|
|
||||||
//.Enrich.With(new ApiKeyMaskingEnricher("appsettings.json")) // TODO - Not working currently
|
|
||||||
.CreateLogger();
|
|
||||||
|
|
||||||
|
|
||||||
builder.Services.AddSerilog();
|
builder.Services.AddSerilog();
|
||||||
|
|
||||||
@@ -99,4 +90,24 @@ internal class Program
|
|||||||
new { t = new TRouteConstraint("search") });
|
new { t = new TRouteConstraint("search") });
|
||||||
app.Run();
|
app.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ConfigureLogger(ConfigurationManager configuration)
|
||||||
|
{
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.ReadFrom.Configuration(configuration)
|
||||||
|
.WriteTo.Console(outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")
|
||||||
|
|
||||||
|
#if RELEASE
|
||||||
|
.Filter.ByExcluding(Matching.FromSource("Microsoft.AspNetCore.Mvc"))
|
||||||
|
.Filter.ByExcluding(Matching.FromSource("Microsoft.AspNetCore.Routing"))
|
||||||
|
.Filter.ByExcluding(Matching.FromSource("Microsoft.AspNetCore.Diagnostics"))
|
||||||
|
.Filter.ByExcluding(Matching.FromSource("Microsoft.AspNetCore.Hosting"))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// TODO workaround to not log api keys
|
||||||
|
.Filter.ByExcluding(Matching.FromSource("System.Net.Http.HttpClient"))
|
||||||
|
.Filter.ByExcluding(Matching.FromSource("Microsoft.Extensions.Http.DefaultHttpClientFactory"))
|
||||||
|
//.Enrich.With(new ApiKeyMaskingEnricher("appsettings.json")) // TODO - Not working currently
|
||||||
|
.CreateLogger();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user