-
Notifications
You must be signed in to change notification settings - Fork 15
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
emitter: add "streaming brief" feature #166
Conversation
e9cf33a
to
289925b
Compare
Codecov Report
@@ Coverage Diff @@
## main #166 +/- ##
==========================================
+ Coverage 94.40% 94.54% +0.13%
==========================================
Files 7 7
Lines 1019 1044 +25
Branches 187 192 +5
==========================================
+ Hits 962 987 +25
Misses 53 53
Partials 4 4
|
5f99e52
to
5fe64cf
Compare
This commit adds a new feature to the Emitter, tentatively called "streaming brief". It is initially disabled, and can be enabled in the Emitter's init() call. Once enabled, the feature will leverage the "multi-action" nature of progress() calls to "stream", in a single line, info-level log messages and text written to the open_stream()'s pipe when in BRIEF mode. For example, the following sequence of calls (in BRIEF mode): ``` emit.progress("Starting stage 1", permanent=False) ... log.info("Doing first step") ... log.info("Doing second step") ... emit.progress("Finished stage 1", permanent=True) ``` ... will cause the two 'info' messages to "stream" on the terminal, prefixed by "Starting stage 1 ::" to indicate that they are related to that progress message. All these three messages are ephemeral which means that in the end only the final progress() call will be visible on the terminal. Fixes #165
5fe64cf
to
e60af45
Compare
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.
Looks good, thank you! I don't have any specific changes to request, but I'd like to hear what you think about some of my comments.
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.
It looks reasonable in a global overview, but it's possible that the changes could result in unexpected behavior in some corner case. Let's keep an eye open and fix later if needed.
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.
Thanks for humouring my questions!
This commit adds a new feature to the Emitter, tentatively called "streaming brief". It is initially disabled, and can be enabled in the Emitter's init() call.
Once enabled, the feature will leverage the "multi-action" nature of progress() calls to "stream", in a single line, info-level log messages and text written to the open_stream()'s pipe. For example, the following sequence of calls in BRIEF mode:
... will cause the two 'info' messages to "stream" on the terminal, prefixed by "Starting stage 1 ::" to indicate that they are related to that progress message. All these three messages are ephemeral which means that in the end only the final progress() call will be visible on the terminal.
Fixes #165
tox
?