Skip to content

Hide traceback from obsws-python on failed connection#14

Open
pniedzielski wants to merge 1 commit intomainfrom
fix/tracebacks
Open

Hide traceback from obsws-python on failed connection#14
pniedzielski wants to merge 1 commit intomainfrom
fix/tracebacks

Conversation

@pniedzielski
Copy link
Copy Markdown
Owner

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.

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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_python logger 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_python logger level after the connection attempt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/backend.py
Comment on lines +56 to +59
obs_logger = logging.getLogger("obsws_python")
original_level = obs_logger.level
obs_logger.setLevel(logging.CRITICAL)

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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