-
Notifications
You must be signed in to change notification settings - Fork 0
Native logging that's more reliable #68
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
Replace shell redirect logging with native file logging for better crash debugging. C binaries now use LOG_FILE env var to write logs directly, with optional LOG_SYNC=1 for fsync after each write.
Adds LOG_debug calls through the initialization of minui, minarch, and shui to help diagnose boot crashes. Also fixes shui to log to its own file (shui.log) instead of inheriting minui.log.
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 pull request adds comprehensive native logging infrastructure to help track down crashes in C binaries across various platforms. The changes introduce a new global logging API that uses environment variables (LOG_FILE and LOG_SYNC) to configure file-based logging with optional crash-safe synchronization.
Key changes:
- Implements
log_open()andlog_close()API for global logging initialization with environment variable support - Adds signal handlers (SIGTERM/SIGINT) to keymon daemons for clean shutdown and proper log flushing
- Updates platform init scripts to set
LOG_FILEenvironment variable for keymon - Adds extensive debug logging throughout minarch and shui for initialization tracking
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| workspace/all/common/log.h | Adds global logging API documentation (log_open, log_close, log_sync, log_is_file_open) with environment variable support |
| workspace/all/common/log.c | Implements global logging with LOG_FILE/LOG_SYNC environment variables, thread-safe file operations, and crash-safe sync mode |
| workspace/all/utils/keymon/keymon.c | Adds signal handling for clean shutdown, integrates log_open/log_close, changes main loop to respect running flag |
| workspace/miyoomini/keymon/keymon.c | Adds signal handling and integrates log_open/log_close with proper cleanup in quit() |
| workspace/all/minui/minui.c | Initializes logging early in main(), calls log_close() on all exit paths |
| workspace/all/minarch/minarch.c | Initializes logging early, adds extensive debug logging for initialization steps, closes log on exit |
| workspace/all/utils/shui/shui.c | Initializes logging in daemon mode, adds debug logging throughout daemon lifecycle, closes log on exit |
| workspace/all/paks/MinUI/platforms/*/init.sh | Updates keymon launch to use LOG_FILE environment variable instead of shell redirection (11 platform files) |
| workspace/all/paks/MinUI/platforms/my355/init.sh | Removes shell redirection (2>&1) in favor of native logging |
| workspace/all/paks/MinUI/launch.sh.template | Adds documentation for LOG_FILE/LOG_SYNC, updates binary launches to use LOG_FILE, renames shell log from minui.log to shell.log |
| tests/unit/all/common/test_log.c | Adds 16 comprehensive test cases for global logging API covering environment variables, reopening, sync mode, and log routing |
| makefile.qa | Enables INFO and DEBUG logs for log tests to validate all log levels |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
072296f to
48bc51e
Compare
Needed to help track down crashes across our various C binaries.