Skip to content

Commit baa1585

Browse files
committed
Logging parameters converted to Pascal case
1 parent 7840fac commit baa1585

31 files changed

+100
-103
lines changed

src/Particular.LicensingComponent/AuditThroughput/AuditThroughputCollectorHostedService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class AuditThroughputCollectorHostedService(
2020

2121
protected override async Task ExecuteAsync(CancellationToken cancellationToken)
2222
{
23-
logger.LogInformation($"Starting {nameof(AuditThroughputCollectorHostedService)}");
23+
logger.LogInformation("Starting {ServiceName}", nameof(AuditThroughputCollectorHostedService));
2424

2525
try
2626
{
@@ -42,14 +42,14 @@ protected override async Task ExecuteAsync(CancellationToken cancellationToken)
4242
}
4343
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
4444
{
45-
logger.LogInformation($"Stopping {nameof(AuditThroughputCollectorHostedService)}");
45+
logger.LogInformation("Stopping {ServiceName}", nameof(AuditThroughputCollectorHostedService));
4646
}
4747
}
4848

4949
async Task GatherThroughput(CancellationToken cancellationToken)
5050
{
5151
var utcYesterday = DateOnly.FromDateTime(timeProvider.GetUtcNow().DateTime).AddDays(-1);
52-
logger.LogInformation($"Gathering throughput from audit for {utcYesterday.ToShortDateString()}");
52+
logger.LogInformation("Gathering throughput from audit for {AuditDate}", utcYesterday.ToShortDateString());
5353

5454
await VerifyAuditInstances(cancellationToken);
5555

@@ -115,18 +115,18 @@ async Task VerifyAuditInstances(CancellationToken cancellationToken)
115115
{
116116
if (remote.Status == "online" || remote.SemanticVersion is not null)
117117
{
118-
logger.LogInformation($"ServiceControl Audit instance at {remote.ApiUri} detected running version {remote.SemanticVersion}");
118+
logger.LogInformation("ServiceControl Audit instance at {RemoteApiUri} detected running version {RemoteSemanticVersion}", remote.ApiUri, remote.SemanticVersion);
119119
}
120120
else
121121
{
122-
logger.LogWarning($"Unable to determine the version of one or more ServiceControl Audit instances. For the instance with URI {remote.ApiUri}, the status was '{remote.Status}' and the version string returned was '{remote.VersionString}'.");
122+
logger.LogWarning("Unable to determine the version of one or more ServiceControl Audit instances. For the instance with URI {RemoteApiUri}, the status was '{RemoteStatus}' and the version string returned was '{RemoteVersionString}'.", remote.ApiUri, remote.Status, remote.VersionString);
123123
}
124124
}
125125

126126
var allHaveAuditCounts = remotesInfo.All(auditQuery.ValidRemoteInstances);
127127
if (!allHaveAuditCounts)
128128
{
129-
logger.LogWarning($"At least one ServiceControl Audit instance is either not running the required version ({auditQuery.MinAuditCountsVersion}) or is not configured for at least 2 days of retention. Audit throughput will not be available.");
129+
logger.LogWarning("At least one ServiceControl Audit instance is either not running the required version ({RequiredAuditVersion}) or is not configured for at least 2 days of retention. Audit throughput will not be available.", auditQuery.MinAuditCountsVersion);
130130
}
131131
}
132132

src/Particular.LicensingComponent/BrokerThroughput/BrokerThroughputCollectorHostedService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ static ReadOnlyDictionary<string, string> LoadBrokerSettingValues(IEnumerable<Ke
2929

3030
if (brokerThroughputQuery.HasInitialisationErrors(out var errorMessage))
3131
{
32-
logger.LogError($"Could not start {nameof(BrokerThroughputCollectorHostedService)}, due to initialisation errors:\n{errorMessage}");
32+
logger.LogError("Could not start {ServiceName}, due to initialisation errors:\n{InitializationErrors}", nameof(BrokerThroughputCollectorHostedService), errorMessage);
3333
return;
3434
}
3535

36-
logger.LogInformation($"Starting {nameof(BrokerThroughputCollectorHostedService)}");
36+
logger.LogInformation("Starting {ServiceName}", nameof(BrokerThroughputCollectorHostedService));
3737

3838
try
3939
{
@@ -55,7 +55,7 @@ static ReadOnlyDictionary<string, string> LoadBrokerSettingValues(IEnumerable<Ke
5555
}
5656
catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested)
5757
{
58-
logger.LogInformation($"Stopping {nameof(BrokerThroughputCollectorHostedService)}");
58+
logger.LogInformation("Stopping {ServiceName}", nameof(BrokerThroughputCollectorHostedService));
5959
}
6060
}
6161

src/Particular.LicensingComponent/MonitoringThroughput/MonitoringThroughputHostedService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ async Task Handle(MessageContext message, CancellationToken cancellationToken)
2424

2525
public async Task StartAsync(CancellationToken cancellationToken)
2626
{
27-
logger.LogInformation($"Starting {nameof(MonitoringThroughputHostedService)}");
27+
logger.LogInformation("Starting {ServiceName}", nameof(MonitoringThroughputHostedService));
2828

2929
transportInfrastructure = await transportCustomization.CreateTransportInfrastructure(ServiceControlSettings.ServiceControlThroughputDataQueue, transportSettings, Handle, (_, __) => Task.FromResult(ErrorHandleResult.Handled), (_, __) => Task.CompletedTask);
3030
await transportInfrastructure.Receivers[ServiceControlSettings.ServiceControlThroughputDataQueue].StartReceive(cancellationToken);
3131
}
3232

3333
public async Task StopAsync(CancellationToken cancellationToken)
3434
{
35-
logger.LogInformation($"Stopping {nameof(MonitoringThroughputHostedService)}");
35+
logger.LogInformation("Stopping {ServiceName}", nameof(MonitoringThroughputHostedService));
3636

3737
if (transportInfrastructure != null)
3838
{

src/ServiceControl/CompositeViews/Messages/GetMessagesController.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ public async Task<IActionResult> Get(string id, [FromQuery(Name = "instance_id")
107107
var forwarderError = await forwarder.SendAsync(HttpContext, remote.BaseAddress, httpMessageInvoker);
108108
if (forwarderError != ForwarderError.None && HttpContext.GetForwarderErrorFeature()?.Exception is { } exception)
109109
{
110-
logger.LogWarning(exception, "Failed to forward the request to remote instance at {remoteBaseAddress}{httpPathAndQuery}",
111-
remote.BaseAddress,
112-
HttpContext.Request.GetEncodedPathAndQuery());
110+
logger.LogWarning(exception, "Failed to forward the request to remote instance at {RemoteInstanceUrl}",
111+
remote.BaseAddress + HttpContext.Request.GetEncodedPathAndQuery());
113112
}
114113

115114
return Empty;

src/ServiceControl/CompositeViews/Messages/ScatterGatherApi.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,19 @@ async Task<QueryResult<TOut>> FetchAndParse(HttpClient httpClient, string pathAn
122122
remoteInstanceSetting.TemporarilyUnavailable = true;
123123
logger.LogWarning(
124124
httpRequestException,
125-
"An HttpRequestException occurred when querying remote instance at {remoteInstanceSettingBaseAddress}. The instance at uri: {remoteInstanceSettingBaseAddress} will be temporarily disabled",
125+
"An HttpRequestException occurred when querying remote instance at {RemoteInstanceBaseAddress}. The instance at uri: {RemoteInstanceBaseAddress} will be temporarily disabled",
126126
remoteInstanceSetting.BaseAddress,
127127
remoteInstanceSetting.BaseAddress);
128128
return QueryResult<TOut>.Empty();
129129
}
130130
catch (OperationCanceledException) // Intentional, used to gracefully handle timeout
131131
{
132-
logger.LogWarning("Failed to query remote instance at {remoteInstanceSettingBaseAddress} due to a timeout", remoteInstanceSetting.BaseAddress);
132+
logger.LogWarning("Failed to query remote instance at {RemoteInstanceBaseAddress} due to a timeout", remoteInstanceSetting.BaseAddress);
133133
return QueryResult<TOut>.Empty();
134134
}
135135
catch (Exception exception)
136136
{
137-
logger.LogWarning(exception, "Failed to query remote instance at {remoteInstanceSettingBaseAddress}", remoteInstanceSetting.BaseAddress);
137+
logger.LogWarning(exception, "Failed to query remote instance at {RemoteInstanceBaseAddress}", remoteInstanceSetting.BaseAddress);
138138
return QueryResult<TOut>.Empty();
139139
}
140140
}

src/ServiceControl/Connection/RemotePlatformConnectionDetailsProvider.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ async Task UpdateFromRemote(RemoteInstanceSetting remote, PlatformConnectionDeta
3232
catch (Exception ex)
3333
{
3434
var remoteConnectionUri = $"{remote.BaseAddress.TrimEnd('/')}/connection";
35-
var message = $"Unable to get connection details from ServiceControl Audit instance at {remoteConnectionUri}.";
3635

37-
connection.Errors.Add(message);
38-
39-
logger.LogError(ex, "Unable to get connection details from ServiceControl Audit instance at {remoteConnectionUri}", remoteConnectionUri);
36+
connection.Errors.Add($"Unable to get connection details from ServiceControl Audit instance at {remoteConnectionUri}.");
37+
logger.LogError(ex, "Unable to get connection details from ServiceControl Audit instance at {RemoteInstanceUrl}", remoteConnectionUri);
4038
}
4139
}
4240
}

src/ServiceControl/CustomChecks/InternalCustomChecks/InternalCustomCheckManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async Task<TimerJobExecutionResult> Run(CancellationToken cancellationToken)
5151
var customCheckType = check.GetType();
5252
var reason = $"`{customCheckType}` implementation failed to run.";
5353
result = CheckResult.Failed(reason);
54-
logger.LogError(ex, "`{customCheckType}` implementation failed to run", customCheckType);
54+
logger.LogError(ex, "`{CustomCheckType}` implementation failed to run", customCheckType);
5555
}
5656

5757
var detail = new CustomCheckDetail

src/ServiceControl/ExternalIntegrations/RepeatedFailuresOverTimeCircuitBreaker.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public void Success()
4040

4141
if (timer.Change(Timeout.Infinite, Timeout.Infinite))
4242
{
43-
logger.LogInformation("The circuit breaker for {circuitBreakerName} is now disarmed", name);
43+
logger.LogInformation("The circuit breaker for {CircuitBreakerName} is now disarmed", name);
4444
}
4545
else
4646
{
47-
logger.LogError("Attempted to disarm circuit breaker for {circuitBreakerName} but failed", name);
47+
logger.LogError("Attempted to disarm circuit breaker for {CircuitBreakerName} but failed", name);
4848
}
4949
}
5050

@@ -57,11 +57,11 @@ public Task Failure(Exception exception)
5757
{
5858
if (timer.Change(timeToWaitBeforeTriggering, NoPeriodicTriggering))
5959
{
60-
logger.LogWarning("The circuit breaker for {circuitBreakerName} is now in the armed state", name);
60+
logger.LogWarning("The circuit breaker for {CircuitBreakerName} is now in the armed state", name);
6161
}
6262
else
6363
{
64-
logger.LogError("Attempted to arm circuit breaker for {circuitBreakerName} but failed", name);
64+
logger.LogError("Attempted to arm circuit breaker for {CircuitBreakerName} but failed", name);
6565
}
6666
}
6767

@@ -72,7 +72,7 @@ void CircuitBreakerTriggered(object state)
7272
{
7373
if (Interlocked.Read(ref failureCount) > 0)
7474
{
75-
logger.LogWarning("The circuit breaker for {circuitBreakerName} will now be triggered", name);
75+
logger.LogWarning("The circuit breaker for {CircuitBreakerName} will now be triggered", name);
7676
triggerAction(lastException);
7777
}
7878
}

src/ServiceControl/Infrastructure/Settings/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ void LoadErrorIngestionSettings()
402402

403403
if (!IngestErrorMessages)
404404
{
405-
logger.LogInformation("Error ingestion disabled.");
405+
logger.LogInformation("Error ingestion disabled");
406406
}
407407

408408
ErrorLogQueue = SettingsReader.Read<string>(serviceBusRootNamespace, "ErrorLogQueue", null);

src/ServiceControl/Infrastructure/SignalR/MessageStreamerHub.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public async Task SendMessage(string data)
5151
}
5252
catch (Exception ex)
5353
{
54-
logger.LogError(ex, "Failed to process SignalR message. AuditMessage={auditMessage}", data);
54+
logger.LogError(ex, "Failed to process SignalR message. AuditMessage={AuditMessage}", data);
5555
throw;
5656
}
5757
}

0 commit comments

Comments
 (0)