1
0
mirror of https://github.com/bitwarden/server synced 2025-12-17 00:33:23 +00:00

adjusted serilog inclusion predicate with bypassid

This commit is contained in:
Kyle Spearrin
2018-08-15 10:54:15 -04:00
parent 6b4605e228
commit 25899fd326
8 changed files with 51 additions and 26 deletions

View File

@@ -22,14 +22,23 @@ namespace Bit.Core.Utilities
return factory;
}
if(filter == null)
bool inclusionPredicate(LogEvent e)
{
filter = (e) => true;
if(filter == null)
{
return true;
}
var eventId = e.Properties.ContainsKey("EventId") ? e.Properties["EventId"].ToString() : null;
if(eventId?.Contains(Constants.BypassFiltersEventId.ToString()) ?? false)
{
return true;
}
return filter(e);
}
var config = new LoggerConfiguration()
.Enrich.FromLogContext()
.Filter.ByIncludingOnly(filter);
.Filter.ByIncludingOnly(inclusionPredicate);
if(CoreHelpers.SettingHasValue(globalSettings?.DocumentDb.Uri) &&
CoreHelpers.SettingHasValue(globalSettings?.DocumentDb.Key))