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.

This commit is contained in:
Admin9705
2025-06-08 16:37:09 -04:00
parent 242f806bff
commit c9382d4f3a
13 changed files with 21 additions and 21 deletions

View File

@@ -44,9 +44,9 @@ def get_configured_instances():
# Enhanced URL validation - ensure URL has proper scheme
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
eros_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
eros_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
api_url = f"http://{api_url}"
eros_logger.warning(f"Auto-correcting URL to: {api_url}")
eros_logger.debug(f"Auto-correcting URL to: {api_url}")
is_enabled = instance.get("enabled", True)

View File

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

View File

@@ -33,9 +33,9 @@ def get_configured_instances():
# Enhanced URL validation - ensure URL has proper scheme
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
lidarr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
lidarr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
api_url = f"http://{api_url}"
lidarr_logger.warning(f"Auto-correcting URL to: {api_url}")
lidarr_logger.debug(f"Auto-correcting URL to: {api_url}")
is_enabled = instance.get("enabled", True)

View File

@@ -34,7 +34,7 @@ def test_connection():
if not (api_url.startswith('http://') or api_url.startswith('https://')):
lidarr_logger.warning(f"API URL missing http(s) scheme: {api_url}")
api_url = f"http://{api_url}"
lidarr_logger.warning(f"Auto-correcting URL to: {api_url}")
lidarr_logger.debug(f"Auto-correcting URL to: {api_url}")
# Try to establish a socket connection first to check basic connectivity
parsed_url = urlparse(api_url)

View File

@@ -32,9 +32,9 @@ def get_configured_instances():
# Enhanced URL validation - ensure URL has proper scheme
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
radarr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
radarr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
radarr_logger.debug(f"Auto-correcting URL to: {api_url}")
api_url = f"http://{api_url}"
radarr_logger.warning(f"Auto-correcting URL to: {api_url}")
# Create a settings object for this instance by combining global settings with instance-specific ones
instance_settings = settings.copy()

View File

@@ -207,7 +207,7 @@ def process_missing_movies(
else:
# No valid release dates found at all, include in search to be safe
should_include = True
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")
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")
if should_include:
filtered_movies.append(movie)

View File

@@ -34,7 +34,7 @@ def test_connection():
if not (api_url.startswith('http://') or api_url.startswith('https://')):
radarr_logger.warning(f"API URL missing http(s) scheme: {api_url}")
api_url = f"http://{api_url}"
radarr_logger.warning(f"Auto-correcting URL to: {api_url}")
radarr_logger.debug(f"Auto-correcting URL to: {api_url}")
# Try to establish a socket connection first to check basic connectivity
parsed_url = urlparse(api_url)

View File

@@ -33,9 +33,9 @@ def get_configured_instances():
# Enhanced URL validation - ensure URL has proper scheme
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
readarr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
readarr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
readarr_logger.debug(f"Auto-correcting URL to: {api_url}")
api_url = f"http://{api_url}"
readarr_logger.warning(f"Auto-correcting URL to: {api_url}")
is_enabled = instance.get("enabled", True)

View File

@@ -33,7 +33,7 @@ def test_connection():
if not (api_url.startswith('http://') or api_url.startswith('https://')):
readarr_logger.warning(f"API URL missing http(s) scheme: {api_url}")
api_url = f"http://{api_url}"
readarr_logger.warning(f"Auto-correcting URL to: {api_url}")
readarr_logger.debug(f"Auto-correcting URL to: {api_url}")
# For Readarr, use api/v1
url = f"{api_url}/api/v1/system/status"

View File

@@ -32,9 +32,9 @@ def get_configured_instances():
# Enhanced URL validation - ensure URL has proper scheme
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
sonarr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
sonarr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
api_url = f"http://{api_url}"
sonarr_logger.warning(f"Auto-correcting URL to: {api_url}")
sonarr_logger.debug(f"Auto-correcting URL to: {api_url}")
is_enabled = instance.get("enabled", True)

View File

@@ -33,9 +33,9 @@ def test_connection():
# Auto-correct URL if missing http(s) scheme
if not (api_url.startswith('http://') or api_url.startswith('https://')):
sonarr_logger.warning(f"API URL missing http(s) scheme: {api_url}")
sonarr_logger.debug(f"Auto-correcting URL to: {api_url}")
api_url = f"http://{api_url}"
sonarr_logger.warning(f"Auto-correcting URL to: {api_url}")
sonarr_logger.debug(f"Auto-correcting URL to: {api_url}")
# Try to establish a socket connection first to check basic connectivity
parsed_url = urlparse(api_url)

View File

@@ -44,9 +44,9 @@ def get_configured_instances():
# Enhanced URL validation - ensure URL has proper scheme
if api_url and not (api_url.startswith('http://') or api_url.startswith('https://')):
whisparr_logger.warning(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
whisparr_logger.debug(f"Instance '{instance.get('name', 'Unnamed')}' has URL without http(s) scheme: {api_url}")
api_url = f"http://{api_url}"
whisparr_logger.warning(f"Auto-correcting URL to: {api_url}")
whisparr_logger.debug(f"Auto-correcting URL to: {api_url}")
is_enabled = instance.get("enabled", True)

View File

@@ -68,7 +68,7 @@ def test_connection():
if not (api_url.startswith('http://') or api_url.startswith('https://')):
whisparr_logger.warning(f"API URL missing http(s) scheme: {api_url}")
api_url = f"http://{api_url}"
whisparr_logger.warning(f"Auto-correcting URL to: {api_url}")
whisparr_logger.debug(f"Auto-correcting URL to: {api_url}")
# Try to establish a socket connection first to check basic connectivity
parsed_url = urlparse(api_url)