-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(logging): Add support for ILogger-based debug logging, including BYO #195
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Narrow +1 on the README. I left some README suggestions you can take or leave as you see fit. Thanks!
SummarySummary
CoverageFauna - 81%
Delta Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it's copacetic with the implementation in the other drivers.
Description
BT-5158
This change adds support for additional debug/trace logging in the driver via
Microsoft.Extensions.Logging.ILogger
interface. Consumers of the driver can set theFAUNA_DEBUG
environment variable to0
or1
(higher is less verbose in .NET log-levels, so 2+ won't output anything at the moment), which will cause the newLogger
static class to instantiate a defaultILogger
implementation that writes all messages tostderr
(to avoid pollutingstdout
for consumers). At present, the driver will output details about the HTTP request and response to/from Fauna with theAuthorization
header value redacted for security reasons.However, if consumers want to bring their own
ILogger
implementation (i.e. Serilog), they can pass it to theConfiguration
class when creating aClient
object. The README has an example.Motivation and context
The driver should provide additional debugging information when desired to help aid in debugging issues for consumers, as well as giving consumers a way to get debug messages that they can send to Fauna Support if they're experiencing issues.
How was the change tested?
I added a test with a
Mock<ILogger>
to make sure we don't break the BYO functionality. I also manually verified the BYO functionality in a test app using Serilog.Output from default logger:
Change types
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.