Skip to content

Commit ad7cc4a

Browse files
authored
use pascal case for structured logging
1 parent 047420b commit ad7cc4a

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/ServiceControl.Audit/Auditing/AuditIngestion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ILogger<AuditIngestion> logger
7070

7171
Task OnCriticalError(string failure, Exception exception)
7272
{
73-
logger.LogCritical(exception, "OnCriticalError. '{failure}'", failure);
73+
logger.LogCritical(exception, "OnCriticalError. '{Failure}'", failure);
7474
return watchdog.OnFailure(failure);
7575
}
7676

@@ -82,7 +82,7 @@ async Task EnsureStarted(CancellationToken cancellationToken)
8282

8383
var canIngest = unitOfWorkFactory.CanIngestMore();
8484

85-
logger.LogDebug("Ensure started {canIngest}", canIngest);
85+
logger.LogDebug("Ensure started {CanIngest}", canIngest);
8686

8787
if (canIngest)
8888
{

src/ServiceControl.Audit/Auditing/AuditPersister.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public async Task<IReadOnlyList<MessageContext>> Persist(IReadOnlyList<MessageCo
7373

7474
foreach (var endpoint in knownEndpoints.Values)
7575
{
76-
logger.LogDebug("Adding known endpoint '{endpointName}' for bulk storage", endpoint.Name);
76+
logger.LogDebug("Adding known endpoint '{EndpointName}' for bulk storage", endpoint.Name);
7777

7878
await unitOfWork.RecordKnownEndpoint(endpoint, cancellationToken);
7979
}
@@ -155,7 +155,7 @@ void ProcessSagaAuditMessage(MessageContext context)
155155
}
156156
catch (Exception e)
157157
{
158-
logger.LogWarning(e, "Processing of saga audit message '{contextNativeMessageId}' failed.", context.NativeMessageId);
158+
logger.LogWarning(e, "Processing of saga audit message '{NativeMessageId}' failed.", context.NativeMessageId);
159159

160160
// releasing the failed message context early so that they can be retried outside the current batch
161161
context.GetTaskCompletionSource().TrySetException(e);
@@ -188,7 +188,7 @@ async Task ProcessAuditMessage(MessageContext context)
188188

189189
var auditMessage = new ProcessedMessage(context.Headers, new Dictionary<string, object>(metadata));
190190

191-
logger.LogDebug("Emitting {commandsToEmitCount} commands and {messagesToEmitCount} control messages.", commandsToEmit.Count, messagesToEmit.Count);
191+
logger.LogDebug("Emitting {CommandsToEmitCount} commands and {MessagesToEmitCount} control messages.", commandsToEmit.Count, messagesToEmit.Count);
192192

193193
foreach (var commandToEmit in commandsToEmit)
194194
{
@@ -198,7 +198,7 @@ async Task ProcessAuditMessage(MessageContext context)
198198
await messageDispatcher.Value.Dispatch(new TransportOperations(messagesToEmit.ToArray()),
199199
new TransportTransaction()); //Do not hook into the incoming transaction
200200

201-
logger.LogDebug("{commandsToEmitCount} commands and {messagesToEmitCount} control messages emitted.", commandsToEmit.Count, messagesToEmit.Count);
201+
logger.LogDebug("{CommandsToEmitCount} commands and {MessagesToEmitCount} control messages emitted.", commandsToEmit.Count, messagesToEmit.Count);
202202

203203
if (metadata.TryGetValue("SendingEndpoint", out var sendingEndpoint))
204204
{
@@ -215,7 +215,7 @@ await messageDispatcher.Value.Dispatch(new TransportOperations(messagesToEmit.To
215215
}
216216
catch (Exception e)
217217
{
218-
logger.LogWarning(e, "Processing of message '{messageId}' failed.", messageId);
218+
logger.LogWarning(e, "Processing of message '{MessageId}' failed.", messageId);
219219

220220
// releasing the failed message context early so that they can be retried outside the current batch
221221
context.GetTaskCompletionSource().TrySetException(e);

src/ServiceControl.Audit/Auditing/ImportFailedAudits.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@ await failedAuditStore.ProcessFailedMessages(
5252

5353
await markComplete(token);
5454
succeeded++;
55-
logger.LogDebug("Successfully re-imported failed audit message {transportMessageId}.", transportMessage.Id);
55+
logger.LogDebug("Successfully re-imported failed audit message {MessageId}.", transportMessage.Id);
5656
}
5757
catch (OperationCanceledException e) when (token.IsCancellationRequested)
5858
{
5959
logger.LogInformation(e, "Cancelled");
6060
}
6161
catch (Exception e)
6262
{
63-
logger.LogError(e, "Error while attempting to re-import failed audit message {transportMessageId}.", transportMessage.Id);
63+
logger.LogError(e, "Error while attempting to re-import failed audit message {MessageId}.", transportMessage.Id);
6464
failed++;
6565
}
6666

6767
}, cancellationToken);
6868

69-
logger.LogInformation("Done re-importing failed audits. Successfully re-imported {succeeded} messages. Failed re-importing {failed} messages.", succeeded, failed);
69+
logger.LogInformation("Done re-importing failed audits. Successfully re-imported {SuccessCount} messages. Failed re-importing {FailureCount} messages.", succeeded, failed);
7070

7171
if (failed > 0)
7272
{
73-
logger.LogWarning("{failed} messages could not be re-imported. This could indicate a problem with the data. Contact Particular support if you need help with recovering the messages.", failed);
73+
logger.LogWarning("{FailureCount} messages could not be re-imported. This could indicate a problem with the data. Contact Particular support if you need help with recovering the messages.", failed);
7474
}
7575
}
7676

src/ServiceControl.Infrastructure/Watchdog.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Task Start(Action onFailedOnStartup, CancellationToken cancellationToken)
6060
using var cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(shutdownTokenSource.Token);
6161
cancellationTokenSource.CancelAfter(MaxStartDurationMs);
6262

63-
log.LogDebug("Ensuring {taskName} is running", taskName);
63+
log.LogDebug("Ensuring {TaskName} is running", taskName);
6464
await ensureStarted(cancellationTokenSource.Token).ConfigureAwait(false);
6565
clearFailure();
6666
startup = false;
@@ -76,12 +76,12 @@ public Task Start(Action onFailedOnStartup, CancellationToken cancellationToken)
7676

7777
if (startup)
7878
{
79-
log.LogError(e, "Error during initial startup attempt for {taskName}.", taskName);
79+
log.LogError(e, "Error during initial startup attempt for {TaskName}.", taskName);
8080
onFailedOnStartup();
8181
return;
8282
}
8383

84-
log.LogError(e, "Error while trying to start {taskName}. Starting will be retried in {timeToWaitBetweenStartupAttempts}.", taskName, timeToWaitBetweenStartupAttempts);
84+
log.LogError(e, "Error while trying to start {TaskName}. Starting will be retried in {TimeToWaitBetweenStartupAttempts}.", taskName, timeToWaitBetweenStartupAttempts);
8585
}
8686
try
8787
{
@@ -101,13 +101,13 @@ public async Task Stop(CancellationToken cancellationToken)
101101
{
102102
try
103103
{
104-
log.LogDebug("Starting watching {taskName}", taskName);
104+
log.LogDebug("Starting watching {TaskName}", taskName);
105105
await shutdownTokenSource.CancelAsync().ConfigureAwait(false);
106106
await watchdog.ConfigureAwait(false);
107107
}
108108
catch (Exception e)
109109
{
110-
log.LogError(e, "Ensuring {taskName} is running", taskName);
110+
log.LogError(e, "Ensuring {TaskName} is running", taskName);
111111
throw;
112112
}
113113
finally

src/ServiceControl/App.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ These settings are only here so that we can debug ServiceControl while developin
4646
<!--PostgreSQL -->
4747
<!--<add name="NServiceBus/Transport" connectionString="Server=;Database=nservicebus;Port=5432;User Id=;Password=" />-->
4848

49-
<!--RabbitMQ.QuorumConventionalRouting-->
49+
<!--RabbitMQ.QuorumConventionalRouting -->
5050
<!--<add name="NServiceBus/Transport" connectionString="host=;username=;password=" />-->
5151

5252
<!--SQLServer -->

0 commit comments

Comments
 (0)