Start using LoggerFactory

This commit is contained in:
Nikolaj
2020-09-15 12:40:35 +02:00
parent 9fa4319940
commit 0238d6eb02
22 changed files with 119 additions and 80 deletions

View File

@@ -16,7 +16,8 @@ namespace Umbraco.Web.Scheduling
private readonly HealthCheckCollection _healthChecks;
private readonly HealthCheckNotificationMethodCollection _notifications;
private readonly IScopeProvider _scopeProvider;
private readonly IProfilingLogger _logger;
private readonly IProfilingLogger _pLogger;
private readonly ILogger _logger;
private readonly IHealthChecksSettings _healthChecksSettingsConfig;
private readonly IServerRegistrar _serverRegistrar;
private readonly IRuntimeState _runtimeState;
@@ -28,7 +29,8 @@ namespace Umbraco.Web.Scheduling
HealthCheckCollection healthChecks,
HealthCheckNotificationMethodCollection notifications,
IMainDom mainDom,
IProfilingLogger logger,
IProfilingLogger pLogger,
ILogger logger,
IHealthChecksSettings healthChecksSettingsConfig,
IServerRegistrar serverRegistrar,
IRuntimeState runtimeState,
@@ -40,6 +42,7 @@ namespace Umbraco.Web.Scheduling
_mainDom = mainDom;
_scopeProvider = scopeProvider;
_runtimeState = runtimeState;
_pLogger = pLogger;
_logger = logger;
_healthChecksSettingsConfig = healthChecksSettingsConfig;
_serverRegistrar = serverRegistrar;
@@ -54,17 +57,17 @@ namespace Umbraco.Web.Scheduling
switch (_serverRegistrar.GetCurrentServerRole())
{
case ServerRole.Replica:
_logger.Debug<HealthCheckNotifier>("Does not run on replica servers.");
_logger.LogDebug("Does not run on replica servers.");
return true; // DO repeat, server role can change
case ServerRole.Unknown:
_logger.Debug<HealthCheckNotifier>("Does not run on servers with unknown role.");
_logger.LogDebug("Does not run on servers with unknown role.");
return true; // DO repeat, server role can change
}
// ensure we do not run if not main domain, but do NOT lock it
if (_mainDom.IsMainDom == false)
{
_logger.Debug<HealthCheckNotifier>("Does not run if not MainDom.");
_logger.LogDebug("Does not run if not MainDom.");
return false; // do NOT repeat, going down
}
@@ -72,7 +75,7 @@ namespace Umbraco.Web.Scheduling
// checks can be making service/database calls so we want to ensure the CallContext/Ambient scope
// isn't used since that can be problematic.
using (var scope = _scopeProvider.CreateScope())
using (_logger.DebugDuration<HealthCheckNotifier>("Health checks executing", "Health checks complete"))
using (_pLogger.DebugDuration<HealthCheckNotifier>("Health checks executing", "Health checks complete"))
{
var healthCheckConfig = _healthChecksSettingsConfig;