1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 16:42:50 -05:00

cleanup startup logging

This commit is contained in:
Kyle Spearrin
2017-10-23 09:11:25 -04:00
parent 21f614bb2e
commit 5069814c4f
5 changed files with 40 additions and 46 deletions

View File

@ -149,28 +149,27 @@ namespace Bit.Api
IApplicationLifetime appLifetime,
GlobalSettings globalSettings)
{
loggerFactory
.AddSerilog(env, appLifetime, globalSettings, (e) =>
loggerFactory.AddSerilog(env, appLifetime, globalSettings, (e) =>
{
var context = e.Properties["SourceContext"].ToString();
if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
e.Exception.Message == "Bad security stamp."))
{
var context = e.Properties["SourceContext"].ToString();
if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
e.Exception.Message == "Bad security stamp."))
{
return false;
}
return false;
}
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
{
return true;
}
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
{
return true;
}
if(context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
if(context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
return e.Level >= LogEventLevel.Error;
});
return e.Level >= LogEventLevel.Error;
});
// Default Middleware
app.UseDefaultMiddleware(env);