Skip to content

Log the server choice and retries at debug level - #1594

Merged
frenck merged 1 commit into
mainfrom
frenck/debug-logging
Oct 2, 2026
Merged

frenck merged 1 commit into
mainfrom
frenck/debug-logging

Conversation

@frenck

@frenck frenck commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Breaking change

None. Debug logging only.

Proposed change

Found while comparing with other Radio Browser clients: radiobrowser4j and RadioBrowserKit log their server choice and retries. python-radios logged nothing at all, so a Home Assistant user with debug logging turned on saw a request take tens of seconds without a clue why.

The client now logs, at debug level only:

A successful request logs nothing, so turning on debug logging stays useful. Live, a request that keeps timing out looks like this:

radios.radio_browser DEBUG Found Radio Browser API servers: de1.api.radio-browser.info
radios.radio_browser DEBUG Using Radio Browser API server de1.api.radio-browser.info
radios.radio_browser DEBUG Request stats failed on attempt 1 of 5 (TimeoutError()), retrying in 0.6s
radios.radio_browser DEBUG Request stats failed on attempt 2 of 5 (TimeoutError()), retrying in 0.9s

The cause is logged with its type, since a TimeoutError() has no message of its own. The README shows how to turn the logging on.

Type of change

  • Dependency or tooling upgrade
  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Deprecation (replaces or removes a feature, with a migration path)
  • Breaking change (a fix or feature that changes existing behavior)
  • Code quality, refactor, or test-only change
  • Documentation only

Additional information

Checklist

  • I fully understand the code in this pull request and can explain every line, including any AI-assisted changes.
  • The change is covered by tests, and poetry run pytest passes locally. A pull request cannot be merged unless CI is green.
  • poetry run prek run --all-files passes (lint, format, and type checks).
  • No commented-out or dead code is left in the pull request.

A request could silently retry for tens of seconds. Log which servers
were found, which one is used, why the client falls back to the host name
of all servers, and every failed attempt with its cause and wait.
@frenck frenck added the enhancement Enhancement of the code, not introducing new features. label Oct 2, 2026
@frenck
frenck merged commit 45dee21 into main Oct 2, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement of the code, not introducing new features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant