This repository was archived by the owner on Feb 22, 2023. It is now read-only.
[firebase_storage] Remove StorageTaskEvent prints #1944
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reason
It is generally pretty annoying to see prints in your logs from sources you do not control and in this case, any user could manually add print statements (or even better, other kinds of notifications) very easily.
More importantly, this actually becomes a problem when running multiple uploads simultaneously. Here is a list of issues I encountered:
There is no indication as to which upload the print statement is referring to, it is just a continuous stream of
EVENT StorageTaskEventType.progressandEVENT StorageTaskEventType.success.There is no way to disable these prints if I do not want them to clutter my logs.
This does impact performance and that is a problem when considering the previous point.
They seem to be delayed? I am not entirely sure about this, but I added an element to my UI that waited for
Future.wait(futures), wherefutureswas a list ofonComplete's and that element showed that all uploads did complete long before the logging stopped.Implementation
I decided to essentially do nothing for the implementation (only remove the
printcall) and here is why:There already is a way to manually print the upload status. I simply added explanation of how to do this both to
README.mdandCHANGELOG.md.I would need to add an implementation to the plugin to make this behavior optional out of the box, which seems redundant to me as there already is a stream that is meant to handle cases like this.
Conclusion
I feel like there is no good answer to the question "Why do we need to print the upload status out of the box in the first place?".
If the developer wants to know about their upload status, they should listen to the stream and this even encourages to find different, possibly better ways, to notify about the upload status than simply printing to the logs.