Draft
Conversation
Implement console.log functionality for both stateless and stateful JavaScript execution modes. This allows JavaScript code running in the V8 isolate to output logs to stdout. Changes: - Add console_log callback function to handle console.log calls - Add create_global_template function to set up global context with console object - Update execute_stateless to use custom global template with console support - Update execute_stateful to use custom global template with console support The console.log implementation accepts multiple arguments and prints them space-separated to stdout, matching standard console.log behavior.
Modified console.log implementation to capture output and return it as part of the execution result instead of printing to stdout. Changes: - Add thread-local storage (CONSOLE_LOGS) to collect console.log output - Update console_log callback to append to thread-local storage - Update execute_stateless to clear logs before execution and combine with result - Update execute_stateful to clear logs before execution and combine with result Console logs are now included in the output, with each log on a new line, followed by the final expression result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implement console.log functionality for both stateless and stateful JavaScript execution modes. This allows JavaScript code running in the V8 isolate to output logs to stdout.
Changes:
The console.log implementation accepts multiple arguments and prints them space-separated to stdout, matching standard console.log behavior.