Skip to content
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

ENH: Improve error log model API to allow log display in console #1044

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

lassoan
Copy link
Member

@lassoan lassoan commented Oct 14, 2022

These changes allow applications to capture all log messages from the error log model (messages can be injected by calling postEntry; and captured by using the new entryAdded signal) and display them in the console. See for example: Slicer/Slicer#5156 (comment)

  • Added postEntry method to log events directly, without going through a message handler, but using the same connection mechanism as message handlers (to ensure logging of messages in the correct order).
  • Added entryAdded signal that provides full log entry information (not just the log level as the existing signal). This can be used for displaying log messages in an additional widget, such as the Python console.
  • Modified ctkConsole's command execution method to allow displaying messages that are logged during execution before showing the next command prompt.

@lassoan lassoan requested a review from jcfr October 14, 2022 04:37
@lassoan lassoan self-assigned this Oct 14, 2022
These changes allow applications to capture all log messages from the error log model (messages can be injected by calling `postEntry`; and captured by using the new `entryAdded` signal) and display them in the console.

- Added `postEntry` method to log events directly, without going through a message handler, but using the same connection mechanism as message handlers (to ensure logging of messages in the correct order).
- Added `entryAdded` signal that provides full log entry information (not just the log level as the existing signal). This can be used for displaying log messages in an additional widget, such as the Python console.
- Modified ctkConsole's command execution method to allow displaying messages that are logged during execution before showing the next command prompt.
@lassoan lassoan force-pushed the get-log-msg-handler-api branch from 2498655 to a0d8362 Compare October 14, 2022 19:18
@lassoan lassoan requested a review from pieper October 14, 2022 19:19
Copy link
Member

@jcfr jcfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking time to update the documentation, the proposed changes make sense.

@jcfr
Copy link
Member

jcfr commented Oct 14, 2022

Nitpick: To prevent future regression, updating ctkErrorLogModelTest1 would be nice.

@lassoan
Copy link
Member Author

lassoan commented Oct 14, 2022

Thanks for the review I may add tests later.

@lassoan lassoan merged commit 19ee431 into commontk:master Oct 14, 2022
@lassoan lassoan deleted the get-log-msg-handler-api branch October 14, 2022 19:41
Copy link
Member

@pieper pieper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be really helpful, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants