1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00

[EC-588] Add secrets override for dev logging (#2309)

This commit is contained in:
Thomas Rittson 2022-09-29 08:02:14 +10:00 committed by GitHub
parent 0629394cec
commit 96fa8781f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -25,6 +25,7 @@ public class GlobalSettings : IGlobalSettings
set => _logDirectory = value;
}
public virtual long? LogRollBySizeLimit { get; set; }
public virtual bool EnableDevLogging { get; set; } = false;
public virtual string LicenseDirectory
{
get => BuildDirectory(_licenseDirectory, "/core/licenses");

View File

@ -20,7 +20,7 @@ public static class LoggerFactoryExtensions
IHostApplicationLifetime applicationLifetime,
GlobalSettings globalSettings)
{
if (env.IsDevelopment())
if (env.IsDevelopment() && !globalSettings.EnableDevLogging)
{
return;
}
@ -33,14 +33,14 @@ public static class LoggerFactoryExtensions
WebHostBuilderContext context,
Func<LogEvent, IGlobalSettings, bool> filter = null)
{
if (context.HostingEnvironment.IsDevelopment())
var globalSettings = new GlobalSettings();
ConfigurationBinder.Bind(context.Configuration.GetSection("GlobalSettings"), globalSettings);
if (context.HostingEnvironment.IsDevelopment() && !globalSettings.EnableDevLogging)
{
return builder;
}
var globalSettings = new GlobalSettings();
ConfigurationBinder.Bind(context.Configuration.GetSection("GlobalSettings"), globalSettings);
bool inclusionPredicate(LogEvent e)
{
if (filter == null)