-
Notifications
You must be signed in to change notification settings - Fork 38
Fix logging for Android #188
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
Merged
Merged
Conversation
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
Eliminated the use of the logging module and related configuration from the _logcatInitScript in cpython.dart. This simplifies the script and avoids unnecessary logging setup during initialization.
Simplifies sync and async execution paths for running Python programs via FFI. Moves core execution logic to a private function, improves error handling, and ensures proper resource cleanup in async mode. Removes redundant message passing and streamlines isolate communication.
Introduces a queue to serialize Python execution requests, preventing concurrent runs. Refactors async execution to use Isolate.run for better port lifecycle management and adds debug logging for run tracking.
Configures Python logging to use a StreamHandler with a custom formatter and replaces all root handlers. Also reformats async Isolate.run() calls for better readability.
Added the 'logging' module import to the logcat initialization script to ensure logging functionality is available during script execution.
Adds a line to explicitly set the root logger's level to its effective level in the embedded Python logging configuration. This ensures consistent logging behavior when initializing the logger.
Changed the root logger's level from its effective level to DEBUG in the embedded Python logging configuration. This ensures all debug messages are captured during execution.
Switches logging from the root logger to a dedicated 'logcat' logger, disables propagation, and sets the log level to ERROR instead of DEBUG. This change improves log handling and reduces log verbosity.
Deleted the line setting 'logcat.propagate = False' from the embedded Python logging configuration. This may allow log messages to propagate to ancestor loggers, aligning with default logging behavior.
Replaces the use of the 'logcat' logger with the root logger when configuring logging in the embedded Python script. This ensures that all logging output is handled consistently at the ERROR level.
Enhanced getPythonError to handle null pointers, memory allocation failures, and fallback error formatting. Replaced Py_DecRef with malloc.free for native strings and ensured proper reference counting and cleanup to prevent memory leaks.
Simplifies and improves Python exception formatting by extracting logic into helper functions and using more robust error handling. Removes unused run sequence tracking and an obsolete isolate runner. Enhances debug logging and clarifies error messages for better maintainability.
Eliminated an unnecessary debug statement before the async Python execution to reduce log verbosity and improve code clarity.
Update all packages to version 0.9.8 and add changelog entries for fixing logging on Android. Also update build.gradle and podspec files to reflect the new version.
Creeper19472
pushed a commit
to cfms-dev/serious-python
that referenced
this pull request
Dec 22, 2025
* Remove logging configuration from logcat init script Eliminated the use of the logging module and related configuration from the _logcatInitScript in cpython.dart. This simplifies the script and avoids unnecessary logging setup during initialization. * Refactor Python FFI execution and isolate handling Simplifies sync and async execution paths for running Python programs via FFI. Moves core execution logic to a private function, improves error handling, and ensures proper resource cleanup in async mode. Removes redundant message passing and streamlines isolate communication. * Serialize Python runs and improve async execution Introduces a queue to serialize Python execution requests, preventing concurrent runs. Refactors async execution to use Isolate.run for better port lifecycle management and adds debug logging for run tracking. * Improve Python logging and format async code Configures Python logging to use a StreamHandler with a custom formatter and replaces all root handlers. Also reformats async Isolate.run() calls for better readability. * Add logging import to logcat init script Added the 'logging' module import to the logcat initialization script to ensure logging functionality is available during script execution. * Set root logger level in embedded Python logging config Adds a line to explicitly set the root logger's level to its effective level in the embedded Python logging configuration. This ensures consistent logging behavior when initializing the logger. * Set Python root logger level to DEBUG Changed the root logger's level from its effective level to DEBUG in the embedded Python logging configuration. This ensures all debug messages are captured during execution. * Update logcat logger configuration in cpython.dart Switches logging from the root logger to a dedicated 'logcat' logger, disables propagation, and sets the log level to ERROR instead of DEBUG. This change improves log handling and reduces log verbosity. * Remove logcat propagate setting in Python logging config Deleted the line setting 'logcat.propagate = False' from the embedded Python logging configuration. This may allow log messages to propagate to ancestor loggers, aligning with default logging behavior. * Use root logger for logcat configuration Replaces the use of the 'logcat' logger with the root logger when configuring logging in the embedded Python script. This ensures that all logging output is handled consistently at the ERROR level. * Improve Python error handling and memory management Enhanced getPythonError to handle null pointers, memory allocation failures, and fallback error formatting. Replaced Py_DecRef with malloc.free for native strings and ensured proper reference counting and cleanup to prevent memory leaks. * Refactor Python error formatting and cleanup Simplifies and improves Python exception formatting by extracting logic into helper functions and using more robust error handling. Removes unused run sequence tracking and an obsolete isolate runner. Enhances debug logging and clarifies error messages for better maintainability. * Remove redundant debug log in async Python runner Eliminated an unnecessary debug statement before the async Python execution to reduce log verbosity and improve code clarity. * Bump version to 0.9.8 and fix Android logging Update all packages to version 0.9.8 and add changelog entries for fixing logging on Android. Also update build.gradle and podspec files to reflect the new version.
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.
No description provided.