Skip to content

Conversation

@gmmcosta15
Copy link
Collaborator

Description

Select the type:

  • Feature
  • Bug fix
  • Code refactor
  • Documentation

BlocksScreen/logger.py:

  • Implemented async logging with QueueHandler and background thread for non-blocking file writes
  • Added AsyncFileHandler with automatic file/directory recreation if deleted during runtime
  • Added StreamToLogger to capture stderr/stdout (X11 errors, subprocess output)
  • Added LogManager class to orchestrate logging setup and cleanup
  • Implemented daily log rotation with 10-day retention
  • Added console output handler for terminal debugging

BlocksScreen/BlocksScreen.py

  • Replaced old logger setup with setup_logging() call
  • Simplified closeEvent to use LogManager.shutdown()
  • Removed dead code (loggers don't have cancel() method

Motivation

  • Non-Blocking I/O: Log writes happen in a background thread, preventing UI freezes during disk I/O
  • Reliability: Automatic recreation of log files/directories if deleted during runtime
  • Unified Capture: X11 errors, warnings, and subprocess output are now captured in the same log file
  • Debugging: Console output allows real-time debugging while still logging to file
  • Clean Shutdown: Proper thread termination and stream restoration on application exit
  • Standard API: All modules can use logging.getLogger(name) pattern

Tests

Tested on RF50,
Missing Unit and Integration Tests

@gmmcosta15 gmmcosta15 requested a review from HugoCLSC January 29, 2026 14:11
@gmmcosta15 gmmcosta15 self-assigned this Jan 29, 2026
@gmmcosta15 gmmcosta15 added enhancement New feature or request. Refactor Enhancing code's readability, maintainability, and extensibility while addressing technical debt. labels Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request. Refactor Enhancing code's readability, maintainability, and extensibility while addressing technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants