-
Couldn't load subscription status.
- Fork 42
Optimize debug log #91
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 optimizes debug logging in the PyWasm WebAssembly runtime by making the debug logging more explicit and streamlined. The changes focus on improving log clarity and reducing verbosity while maintaining essential debugging information.
- Improved debug log condition to be more explicit (
lvl > 0instead oflvl) - Enhanced log formatting by adding 'pywasm:' prefix to all log messages
- Streamlined section parsing debug logs by removing redundant section headers and loop indices
- Reduced disassembly verbosity and commented out verbose call logging
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pywasm/log.py | Enhanced debug logging condition and added pywasm prefix to log messages |
| pywasm/core.py | Streamlined debug logging in WASM module parsing and runtime execution |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| func[i].expr = desc.expr | ||
| pywasm.log.debugln(' ', i, desc) | ||
| desc.expr.into_disasm(8) | ||
| pywasm.log.debugln('section code', desc) |
Copilot
AI
Sep 12, 2025
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] The disassembly indentation level has been reduced from 8 to 4, but there's no documentation explaining why this specific value was chosen or what the parameter represents. Consider adding a comment to clarify the purpose of this magic number.
| pywasm.log.debugln('section code', desc) | |
| pywasm.log.debugln('section code', desc) | |
| # Indent disassembly output by 4 spaces for readability; 4 is chosen to align with other section formatting. |
pywasm/core.py
Outdated
| args = [self.stack.value.pop() for _ in range(len(func.type.args))][::-1] | ||
| nret = len(func.type.rets) | ||
| pywasm.log.debugln('call', func, args) | ||
| # pywasm.log.debugln('call', func, args) |
Copilot
AI
Sep 12, 2025
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] Instead of commenting out this debug log, consider using a different log level or a conditional check. Commented-out code should generally be removed unless there's a specific reason to keep it for future debugging.
| # pywasm.log.debugln('call', func, args) | |
| pywasm.log.debugln('call', func, args) |
No description provided.