Skip to content

Commit c9382d4

Browse files
committed
Refactor logging in API connection methods across Eros, Lidarr, Radarr, Readarr, Sonarr, and Whisparr to use debug level for auto-correcting URLs, enhancing log clarity and reducing warning noise.
1 parent 242f806 commit c9382d4

File tree

13 files changed

+21
-21
lines changed

13 files changed

+21
-21
lines changed

src/primary/apps/eros/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def get_configured_instances():
4444

4545
# Enhanced URL validation - ensure URL has proper scheme
4646
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
47-
eros_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
47+
eros_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
4848
api_url = f"http://{api_url}"
49-
eros_logger.warning(f"Auto-correcting URL to: {api_url}")
49+
eros_logger.debug(f"Auto-correcting URL to: {api_url}")
5050

5151
is_enabled = instance.get("enabled", True)
5252

src/primary/apps/eros_routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_connection(url, api_key):
2626
if not (url.startswith('http://') or url.startswith('https://')):
2727
eros_logger.warning(f"API URL missing http(s) scheme: {url}")
2828
url = f"http://{url}"
29-
eros_logger.warning(f"Auto-correcting URL to: {url}")
29+
eros_logger.debug(f"Auto-correcting URL to: {url}")
3030

3131
# Try to establish a socket connection first to check basic connectivity
3232
parsed_url = urlparse(url)
@@ -179,7 +179,7 @@ def test_connection_endpoint():
179179
if not (api_url.startswith('http://') or api_url.startswith('https://')):
180180
eros_logger.warning(f"API URL missing http(s) scheme: {api_url}")
181181
api_url = f"http://{api_url}"
182-
eros_logger.warning(f"Auto-correcting URL to: {api_url}")
182+
eros_logger.debug(f"Auto-correcting URL to: {api_url}")
183183

184184
return test_connection(api_url, api_key)
185185

src/primary/apps/lidarr/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def get_configured_instances():
3333

3434
# Enhanced URL validation - ensure URL has proper scheme
3535
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
36-
lidarr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
36+
lidarr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
3737
api_url = f"http://{api_url}"
38-
lidarr_logger.warning(f"Auto-correcting URL to: {api_url}")
38+
lidarr_logger.debug(f"Auto-correcting URL to: {api_url}")
3939

4040
is_enabled = instance.get("enabled", True)
4141

src/primary/apps/lidarr_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_connection():
3434
if not (api_url.startswith('http://') or api_url.startswith('https://')):
3535
lidarr_logger.warning(f"API URL missing http(s) scheme: {api_url}")
3636
api_url = f"http://{api_url}"
37-
lidarr_logger.warning(f"Auto-correcting URL to: {api_url}")
37+
lidarr_logger.debug(f"Auto-correcting URL to: {api_url}")
3838

3939
# Try to establish a socket connection first to check basic connectivity
4040
parsed_url = urlparse(api_url)

src/primary/apps/radarr/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def get_configured_instances():
3232

3333
# Enhanced URL validation - ensure URL has proper scheme
3434
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
35-
radarr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
35+
radarr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
36+
radarr_logger.debug(f"Auto-correcting URL to: {api_url}")
3637
api_url = f"http://{api_url}"
37-
radarr_logger.warning(f"Auto-correcting URL to: {api_url}")
3838

3939
# Create a settings object for this instance by combining global settings with instance-specific ones
4040
instance_settings = settings.copy()

src/primary/apps/radarr/missing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def process_missing_movies(
207207
else:
208208
# No valid release dates found at all, include in search to be safe
209209
should_include = True
210-
radarr_logger.warning(f"Movie ID {movie.get('id')} ('{movie.get('title')}') has no physicalRelease, digitalRelease, inCinemas, or releaseDate fields - including in search but this may indicate missing metadata in Radarr")
210+
radarr_logger.debug(f"Movie ID {movie.get('id')} ('{movie.get('title')}') has no physicalRelease, digitalRelease, inCinemas, or releaseDate fields - including in search but this may indicate missing metadata in Radarr")
211211

212212
if should_include:
213213
filtered_movies.append(movie)

src/primary/apps/radarr_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_connection():
3434
if not (api_url.startswith('http://') or api_url.startswith('https://')):
3535
radarr_logger.warning(f"API URL missing http(s) scheme: {api_url}")
3636
api_url = f"http://{api_url}"
37-
radarr_logger.warning(f"Auto-correcting URL to: {api_url}")
37+
radarr_logger.debug(f"Auto-correcting URL to: {api_url}")
3838

3939
# Try to establish a socket connection first to check basic connectivity
4040
parsed_url = urlparse(api_url)

src/primary/apps/readarr/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def get_configured_instances():
3333

3434
# Enhanced URL validation - ensure URL has proper scheme
3535
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
36-
readarr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
36+
readarr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
37+
readarr_logger.debug(f"Auto-correcting URL to: {api_url}")
3738
api_url = f"http://{api_url}"
38-
readarr_logger.warning(f"Auto-correcting URL to: {api_url}")
3939

4040
is_enabled = instance.get("enabled", True)
4141

src/primary/apps/readarr_routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_connection():
3333
if not (api_url.startswith('http://') or api_url.startswith('https://')):
3434
readarr_logger.warning(f"API URL missing http(s) scheme: {api_url}")
3535
api_url = f"http://{api_url}"
36-
readarr_logger.warning(f"Auto-correcting URL to: {api_url}")
36+
readarr_logger.debug(f"Auto-correcting URL to: {api_url}")
3737

3838
# For Readarr, use api/v1
3939
url = f"{api_url}/api/v1/system/status"

src/primary/apps/sonarr/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ def get_configured_instances():
3232

3333
# Enhanced URL validation - ensure URL has proper scheme
3434
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
35-
sonarr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
35+
sonarr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
3636
api_url = f"http://{api_url}"
37-
sonarr_logger.warning(f"Auto-correcting URL to: {api_url}")
37+
sonarr_logger.debug(f"Auto-correcting URL to: {api_url}")
3838

3939
is_enabled = instance.get("enabled", True)
4040

0 commit comments

Comments
 (0)