add more debug data

This commit is contained in:
Antonio J. Delgado 2025-02-17 15:28:08 +02:00
parent 43b426212c
commit ce95bbe185

View file

@ -50,6 +50,7 @@ class MastodonEmailBridge:
'.mastodon_email_bridge_sent_items.db'
)
self._init_log()
self.last_translation_response = None
self._get_sent_posts()
if 'templates_folder' in self.config:
templates_folder=self.config['templates_folder']
@ -284,6 +285,7 @@ class MastodonEmailBridge:
data[field],
source_language=source_language
)
new_data[f"translated_{field}_response"] = self.last_translation_response
self._log.debug(
"Total of %s fields translated",
counter
@ -307,7 +309,8 @@ class MastodonEmailBridge:
data=data,
)
try:
translation = response.json()['translatedText']
self.last_translation_response = response.json()
translation = self.last_translation_response['translatedText']
except Exception as error:
self._log.error(
"Error translating '%s' from '%s' to '%s'. %s. Response content: %s",