Skip to content

Commit e7bf499

Browse files
committed
remove unnecessary static logger
1 parent 912ef81 commit e7bf499

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/ServiceControl.Audit.Persistence.RavenDB/CustomChecks/CheckRavenDBIndexLag.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using NServiceBus.CustomChecks;
1010
using Raven.Client.Documents.Operations;
1111
using ServiceControl.Audit.Persistence.RavenDB;
12-
using ServiceControl.Infrastructure;
1312

1413
class CheckRavenDBIndexLag(IRavenDocumentStoreProvider documentStoreProvider, ILogger<CheckRavenDBIndexLag> logger) : CustomCheck("Audit Database Index Lag", "ServiceControl.Audit Health", TimeSpan.FromMinutes(5))
1514
{
@@ -21,7 +20,7 @@ public override async Task<CheckResult> PerformCheck(CancellationToken cancellat
2120

2221
CreateDiagnosticsLogEntry(statistics, indexes);
2322

24-
var indexCountWithTooMuchLag = CheckAndReportIndexesWithTooMuchIndexLag(indexes, logger);
23+
var indexCountWithTooMuchLag = CheckAndReportIndexesWithTooMuchIndexLag(indexes);
2524

2625
if (indexCountWithTooMuchLag > 0)
2726
{
@@ -31,7 +30,7 @@ public override async Task<CheckResult> PerformCheck(CancellationToken cancellat
3130
return CheckResult.Pass;
3231
}
3332

34-
static int CheckAndReportIndexesWithTooMuchIndexLag(IndexInformation[] indexes, ILogger logger)
33+
int CheckAndReportIndexesWithTooMuchIndexLag(IndexInformation[] indexes)
3534
{
3635
int indexCountWithTooMuchLag = 0;
3736

@@ -57,9 +56,9 @@ static int CheckAndReportIndexesWithTooMuchIndexLag(IndexInformation[] indexes,
5756
return indexCountWithTooMuchLag;
5857
}
5958

60-
static void CreateDiagnosticsLogEntry(DatabaseStatistics statistics, IndexInformation[] indexes)
59+
void CreateDiagnosticsLogEntry(DatabaseStatistics statistics, IndexInformation[] indexes)
6160
{
62-
if (!Logger.IsEnabled(LogLevel.Debug))
61+
if (!logger.IsEnabled(LogLevel.Debug))
6362
{
6463
return;
6564
}
@@ -74,11 +73,10 @@ static void CreateDiagnosticsLogEntry(DatabaseStatistics statistics, IndexInform
7473
report.AppendLine($"- Index [{indexStats.Name,-44}] State: {indexStats.State}, Stale: {indexStats.IsStale,-5}, Priority: {indexStats.Priority,-6}, LastIndexingTime: {indexStats.LastIndexingTime:u}");
7574
}
7675

77-
Logger.LogDebug(report.ToString());
76+
logger.LogDebug(report.ToString());
7877
}
7978

8079
static readonly TimeSpan IndexLagThresholdWarning = TimeSpan.FromMinutes(1);
8180
static readonly TimeSpan IndexLagThresholdError = TimeSpan.FromMinutes(10);
82-
static readonly ILogger<CheckRavenDBIndexLag> Logger = LoggerUtil.CreateStaticLogger<CheckRavenDBIndexLag>();
8381
}
8482
}

0 commit comments

Comments
 (0)