Skip to content

Conversation

@ianohara
Copy link
Collaborator

This adds logging tools in the squid.logging module (along with the squid package), and two helpers there for getting loggers and setting the squid logger logging level. This allows us to have a dedicated hierarchy of loggers that we can configure while leaving all the loggers setup by other libraries alone.

It also adds an example usage in the control._def.py module. We can start converting individual files after this.

It also lays the groundwork for better crash reports by allowing us to hook up handlers for uncaught exceptions. By default these just print to console, but we want to be able to hook up a FileHandler to our logger and have the uncaught exceptions go there as well. Actually creating the FileHandler and attaching it to the root squid logger is to come.

NOTE: This was originally hongquanli#114 but has been moved here since this is going to be the main development repository moving forward.

Tested by:

  1. Attempting to run main_hcs.py, and seeing log messages
  2. I also added a random raise ValueError("test test") in main_hcs.py for a different run to make sure that the handlers work as expected
  3. And via python -m pytest.

@ianohara ianohara merged commit 2afb80a into master Oct 25, 2024
hongquanli pushed a commit that referenced this pull request Feb 25, 2025
hongquanli added a commit that referenced this pull request Jan 28, 2026
Address code review issues #1 and #2:

1. Add port index validation (0-15) to Microcontroller methods:
   - set_port_intensity, turn_on_port, turn_off_port, set_port_illumination
   - Raises ValueError for out-of-range ports, TypeError for non-integers

2. Add wait_till_operation_is_completed() to IlluminationController.set_port_intensity()
   - Makes behavior consistent with turn_on_port() and turn_off_port()
   - Prevents race conditions when setting intensity before turning on

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants