-
-
Notifications
You must be signed in to change notification settings - Fork 739
feat: better I.grab logging in live interactive mode #4986
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
Conversation
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.
Pull Request Overview
This PR improves the logging output in live interactive mode by formatting the output of I.grab commands with JSON.stringify.
- Improved logging by converting the logged value to a JSON string with indentation.
- Enhances clarity during debugging sessions in interactive mode.
Add try/catch Co-authored-by: Copilot <[email protected]>
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.
Pull Request Overview
This PR improves the interactive shell logging during I.grab* commands by stringifying the output, thereby providing clearer and more readable terminal output during live sessions.
- Enhanced readability of interactive shell logs by applying JSON.stringify to the result
- Added error handling to catch potential JSON stringification failures
@@ -175,7 +175,11 @@ async function parseInput(cmd) { | |||
output.print(output.styles.success(' OK '), cmd) | |||
} | |||
if (cmd?.startsWith('I.grab')) { | |||
output.print(output.styles.debug(val)) | |||
try { |
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.
[nitpick] Consider adding a comment here to explain that JSON.stringify is applied to handle various output types for improved readability.
try { | |
try { | |
// Use JSON.stringify to format the output for improved readability, especially for complex objects. |
Copilot uses AI. Check for mistakes.
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.
Pull Request Overview
This PR addresses a bug where interactive logging produced uninformative output and replaces it with JSON stringified output for better readability.
- Adds a try-catch block around JSON.stringify in I.grab command logging
- Improves error reporting during JSON conversion failures
Comments suppressed due to low confidence (1)
lib/pause.js:181
- [nitpick] Consider logging additional error context (such as the full error stack) to improve debugging when JSON.stringify fails.
output.print(output.styles.error(' ERROR '), 'Failed to stringify result:', err.message)
Co-authored-by: Copilot <[email protected]>
Motivation/Description of the PR
Currently, the interactive shell mode with pause() resulting output like:
[Object object]....
this is clearly not useful during live interactive mode when we're using:I.grabBrowserLogs();
or
I.grabRecordedNetworkTraffics();
By json stringify the value, we can safely see every type of output in the terminal session like following.

Applicable helpers:
Applicable plugins:
Type of change
Checklist:
npm run docs
)npm run lint
)npm test
)