-
Notifications
You must be signed in to change notification settings - Fork 51
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: Add the ability to send user feedback to the console even when logging to file. #568
feat: Add the ability to send user feedback to the console even when logging to file. #568
Conversation
You are missing a resolving keyword from the description which is why it's not linking to the issue. |
Codecov Report
@@ Coverage Diff @@
## develop #568 +/- ##
===========================================
+ Coverage 56.08% 56.68% +0.59%
===========================================
Files 121 118 -3
Lines 14231 13997 -234
===========================================
- Hits 7982 7934 -48
+ Misses 5549 5372 -177
+ Partials 700 691 -9
|
question: I am slightly surprised by this PR and assumed it was something else at first. Are you sure the current log functions don't output to both if configured to write to file? suggestion: Assuming it doesn't already do this, might it be better to replace the extra functions with a config boolean that enables logging to both, and have that enabled by default? |
It doesn't. You can try it on the default branch. Set the logging output in your config file and you'll notice that nothing will be logged to the console anymore.
I think it would be better not to do that. In my opinion, interactive feedback should be explicit. Like something the user benefits from seeing. For example there is no benefit to a user to see all the DB log messages for each interaction. Neither is there any benefit in seeing the logs from HTTP requests. But there is benefit in knowing the API port and other such details. |
ec766af
to
eeab10f
Compare
The loggers I have worked with in the past have logged to both file and console - that may have been a deliberately configured choice (not sure, 70-30 odds in favour of deliberate config vs default behaviour). It can be quite useful to have both, and more importantly, this appears to prevent users from making that choice without us reworking the logging interface, and all the places that call it. |
This doesn't prevent the user from making the choice (log output can be set as |
Of course! My bad for forgetting that. Thanks. Am totally happy with the extra funcs then lol |
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.
Cheers for answering my questions. I have doubts as to whether we'd want these calls split by level (would they not all just be info?), but see that as part of the other discussion RE log levels.
Yes that's out scope here and I'll create a new PR once we've made the decision on levels :) |
logging/logging.go
Outdated
// FeedbackDebug calls Debug and sends the message to stderr if logs are sent to a file | ||
FeedbackDebug(ctx context.Context, message string, keyvals ...KV) | ||
// FeedbackInfo calls Info and sends the message to stderr if logs are sent to a file | ||
FeedbackInfo(ctx context.Context, message string, keyvals ...KV) | ||
// FeedbackWarn calls Warn and sends the message to stderr if logs are sent to a file | ||
FeedbackWarn(ctx context.Context, message string, keyvals ...KV) | ||
// FeedbackError calls Error and sends the message to stderr if logs are sent to a file | ||
FeedbackError(ctx context.Context, message string, keyvals ...KV) | ||
// FeedbackErrorE calls ErrorE and sends the message to stderr if logs are sent to a file | ||
FeedbackErrorE(ctx context.Context, message string, err error, keyvals ...KV) | ||
// FeedbackFatal calls Fatal and sends the message to stderr if logs are sent to a file | ||
FeedbackFatal(ctx context.Context, message string, keyvals ...KV) | ||
// FeedbackFatalE calls FatalE and sends the message to stderr if logs are sent to a file |
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.
super-tiny-nitpick: All other comments are ending with a period haha, add ending dots ?
eeab10f
to
2895ba6
Compare
…logging to file. (sourcenetwork#568) Relevant issue(s) Resolves sourcenetwork#507 Description This PR adds the ability to send user feedback to the console even when we configure Defra to send the log to a file. Feedback is sent in plain text as a simple message.
Relevant issue(s)
Resolves #507
Description
This PR adds the ability to send user feedback to the console even when we configure Defra to send the log to a file. Feedback is sent in plain text as a simple message.
Tasks
How has this been tested?
unit test
Specify the platform(s) on which this was tested: