Skip to content

Commit fc117ae

Browse files
authored
chore: Logging tweaks (#4622)
1 parent a213de0 commit fc117ae

12 files changed

+20
-20
lines changed

src/Sentry/GlobalSessionManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private void DeletePersistedSession()
118118
try
119119
{
120120
var contents = _options.FileSystem.ReadAllTextFromFile(filePath);
121-
_options.LogDebug("Deleting persisted session file with contents: {0}", contents);
121+
_options.LogDebug("Deleting persisted session file with contents: '{0}'", contents);
122122
}
123123
catch (Exception ex)
124124
{

src/Sentry/Internal/BackgroundWorker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private async Task DoWorkAsync()
177177
}
178178
finally
179179
{
180-
_options.LogDebug("De-queueing event {0}", eventId);
180+
_options.LogDebug("De-queueing event '{0}'", eventId);
181181
_queue.TryDequeue(out _);
182182
Interlocked.Decrement(ref _currentItems);
183183
OnFlushObjectReceived?.Invoke(envelope, EventArgs.Empty);

src/Sentry/Internal/DebugStackTrace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ internal void MergeDebugImagesInto(SentryEvent @event)
8282
// Frame indexes may be changed as well as _debugImageIndexByModule becoming invalid.
8383
if (_debugImagesMerged)
8484
{
85-
_options.LogWarning("Cannot call MergeDebugImagesInto multiple times. Event: {0}", @event.EventId);
85+
_options.LogWarning("Cannot call MergeDebugImagesInto multiple times. Event: '{0}'", @event.EventId);
8686
return;
8787
}
8888
_debugImagesMerged = true;

src/Sentry/Internal/DuplicateEventDetectionEventProcessor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal class DuplicateEventDetectionEventProcessor : ISentryEventProcessor
1515
{
1616
if (_capturedObjects.TryGetValue(@event, out _))
1717
{
18-
_options.LogDebug("Same event instance detected and discarded. EventId: {0}", @event.EventId);
18+
_options.LogDebug("Same event instance detected and discarded. EventId: '{0}'", @event.EventId);
1919
return null;
2020
}
2121
_capturedObjects.Add(@event, null);
@@ -38,7 +38,7 @@ private bool IsDuplicate(Exception ex, SentryId eventId, bool debugLog)
3838
{
3939
if (debugLog)
4040
{
41-
_options.LogDebug("Duplicate Exception: 'SameExceptionInstance'. Event {0} will be discarded.", eventId);
41+
_options.LogDebug("Duplicate Exception: 'SameExceptionInstance'. Event '{0}' will be discarded.", eventId);
4242
}
4343
return true;
4444
}
@@ -52,7 +52,7 @@ private bool IsDuplicate(Exception ex, SentryId eventId, bool debugLog)
5252
var result = aex.InnerExceptions.Any(e => IsDuplicate(e, eventId, false));
5353
if (result)
5454
{
55-
_options.LogDebug("Duplicate Exception: 'AggregateException'. Event {0} will be discarded.", eventId);
55+
_options.LogDebug("Duplicate Exception: 'AggregateException'. Event '{0}' will be discarded.", eventId);
5656
}
5757

5858
return result;
@@ -63,7 +63,7 @@ private bool IsDuplicate(Exception ex, SentryId eventId, bool debugLog)
6363
{
6464
if (IsDuplicate(ex.InnerException, eventId, false))
6565
{
66-
_options.LogDebug("Duplicate Exception: 'SameExceptionInstance'. Event {0} will be discarded.", eventId);
66+
_options.LogDebug("Duplicate Exception: 'SameExceptionInstance'. Event '{0}' will be discarded.", eventId);
6767
return true;
6868
}
6969
}

src/Sentry/Internal/Http/CachingTransport.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,15 @@ private async Task InnerProcessCacheAsync(string file, CancellationToken cancell
343343

344344
try
345345
{
346-
_options.LogDebug("Sending cached envelope: {0}",
346+
_options.LogDebug("Sending cached envelope: '{0}'",
347347
envelope.TryGetEventId(_options.DiagnosticLogger));
348348

349349
await _innerTransport.SendEnvelopeAsync(envelope, cancellation).ConfigureAwait(false);
350350
}
351351
// OperationCancel should not log an error
352352
catch (OperationCanceledException ex)
353353
{
354-
_options.LogDebug("Canceled sending cached envelope: {0}, retrying after a delay.", ex, file);
354+
_options.LogDebug("Canceled sending cached envelope: '{0}', retrying after a delay.", ex, file);
355355
// Let the worker catch, log, wait a bit and retry.
356356
throw;
357357
}

src/Sentry/Internal/Hub.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ private void AddBreadcrumbForException(SentryEvent evt, Scope scope)
505505
}
506506
catch (Exception e)
507507
{
508-
_options.LogError(e, "Failure to store breadcrumb for exception event: {0}", evt.EventId);
508+
_options.LogError(e, "Failure to store breadcrumb for exception event: '{0}'", evt.EventId);
509509
}
510510
}
511511

src/Sentry/Internal/MainSentryEventProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public MainSentryEventProcessor(
3434

3535
public SentryEvent Process(SentryEvent @event)
3636
{
37-
_options.LogDebug("Running main event processor on: Event {0}", @event.EventId);
37+
_options.LogDebug("Running main event processor on: Event '{0}'", @event.EventId);
3838

3939
if (TimeZoneInfo.Local is { } timeZoneInfo)
4040
{

src/Sentry/Internal/SentryEventHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ internal static class SentryEventHelper
3737
return @event;
3838
}
3939

40-
options.LogDebug("Calling the BeforeSend callback");
40+
options.LogDebug("Calling the BeforeSend callback.");
4141
try
4242
{
4343
@event = options.BeforeSendInternal?.Invoke(@event, hint);

src/Sentry/SentryClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public SentryId CaptureEvent(SentryEvent? @event, Scope? scope = null, SentryHin
7979
}
8080
catch (Exception e)
8181
{
82-
_options.LogError(e, "An error occurred when capturing the event {0}.", @event.EventId);
82+
_options.LogError(e, "An error occurred when capturing the event '{0}'.", @event.EventId);
8383
return SentryId.Empty;
8484
}
8585
}
@@ -445,7 +445,7 @@ public bool CaptureEnvelope(Envelope envelope)
445445
}
446446

447447
_options.LogWarning(
448-
"The attempt to queue the event failed. Items in queue: {0}",
448+
"The attempt to queue the event failed. Items in queue: '{0}'",
449449
Worker.QueuedItems);
450450

451451
return false;

src/Sentry/SentryPropagationContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public DynamicSamplingContext GetOrCreateDynamicSamplingContext(SentryOptions op
1515
{
1616
if (_dynamicSamplingContext is null)
1717
{
18-
options.LogDebug("Creating the Dynamic Sampling Context from the Propagation Context");
18+
options.LogDebug("Creating the Dynamic Sampling Context from the Propagation Context.");
1919
_dynamicSamplingContext = this.CreateDynamicSamplingContext(options, replaySession);
2020
}
2121

0 commit comments

Comments
 (0)