-
Notifications
You must be signed in to change notification settings - Fork 298
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
fxevent.Logger: Silence until there's an error #1167
Comments
@abhinav I've implemented a rudimentary version of this internally. I could raise PR with a variation of it, but a few notes and questions:
|
Hi again @jmmills!
Clarify, please? Ability to convert a non-error event to an error, or to customize the error of an error event into something else before it's logged? For the latter, I think it might make sense to delegate that to an external wrapper of the logger.
I don't think so. Fx assumes single-threaded exclusive execution; the Fx container owns the resources. It would be straightforward for someone to implement a thread-safe wrapper in such a case, so I don't think we'd need to bend for an unusual use case that much.
|
Is your feature request related to a problem? Please describe.
The Fx event log is useful in debugging startup failures when there's a failure.
However, in the success case, it's largely noise.
Describe the solution you'd like
A variant of fxevent.Logger that prints nothing if the service successfully starts up, but prints the full event log if there were any failures in the process.
This would probably take the form of a wrapper around fxevent.Logger that buffers messages in-memory, and flushes them if any of the individual error-able events fails, or if the entire start up fails.
I haven't thought about what the API for this would look like.
Describe alternatives you've considered
Is this a breaking change?
No
The text was updated successfully, but these errors were encountered: