Hide traceback from obsws-python on failed connection#14
Hide traceback from obsws-python on failed connection#14pniedzielski wants to merge 1 commit intomainfrom
Conversation
This patch hides a verbose traceback that obsws-python prints whenever we try to connect to OBS and it’s not running. This is a common case that we handle correctly today, so the frequent multiline tracebacks pollute the logs in StreamController.
ac7fec6 to
92329a8
Compare
There was a problem hiding this comment.
Pull request overview
Reduces log noise when StreamController attempts to connect to OBS while OBS is not running, by suppressing obsws-python’s verbose connection-failure logging and downgrading “connection refused” to a warning.
Changes:
- Temporarily raises the
obsws_pythonlogger level to suppress verbose output during connection attempts. - Treats
ConnectionRefusedError(common when OBS isn’t running) as a warning instead of an error. - Restores the original
obsws_pythonlogger level after the connection attempt.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| obs_logger = logging.getLogger("obsws_python") | ||
| original_level = obs_logger.level | ||
| obs_logger.setLevel(logging.CRITICAL) | ||
|
|
There was a problem hiding this comment.
Temporarily mutating the global obsws_python logger level here can have cross-thread side effects (e.g., connect_to is invoked from a background thread elsewhere), potentially suppressing unrelated OBS logs while another thread is using the client. Consider guarding this with a lock and/or using a scoped approach (e.g., a temporary Filter/handler that only suppresses the specific connection failure noise) to avoid affecting other concurrent OBS interactions.
This patch hides a verbose traceback that obsws-python prints whenever we try to connect to OBS and it’s not running. This is a common case that we handle correctly today, so the frequent multiline tracebacks pollute the logs in StreamController.