Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Structured Logging in a More Structured Way #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chrisoverzero
Copy link

Description of changes:

In several places, empty curly braces ({}) were used in place of
structured logging properties. These were processed as literal
curly braces in logs, and log context was lost. Where the value of
the property was an exception, an Exception-specialized overload
was chosen instead.

This did not alter any places where string interpolation was used
instead of structured logging properties. That could be work for
the future.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

In several places, empty curly braces (`{}`) were used in place of
structured logging properties. These were processed as literal
curly braces, and log context was lost. Where the value of the
property was an exception, an Exception-specialized overload was
chosen instead.

This did not alter any places where string interpolation was used
instead of structured logging properties. That could be work for
the future.
@@ -118,7 +118,7 @@ private Task RunSenderThread(ILoggerFactory loggerFactory)
}
catch (Exception e)
{
logger.LogWarning("Failed to write message to socket. Backing off and trying again. {}", e.Message);
logger.LogWarning(e, "Failed to write message to socket. Backing off and trying again.");
Thread.Sleep(1000); // TODO: backoff
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this shouldn't be:

await Task.Delay(TimeSpan.FromMilliseconds(1000)).ConfigureAwait(false);

…but that felt out of scope and like a Chesterton's Fence thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant