From 0efa0d11853ed8bca1d94b307d0cf20b1202a73b Mon Sep 17 00:00:00 2001 From: Ugo <111749144+ugobok@users.noreply.github.com> Date: Thu, 20 Apr 2023 20:52:45 +0300 Subject: [PATCH] Replace print statements with logging.error This commit replaces two print statements in the _speech method of the BrianSpeech class with a single call to logging.error. This will log error messages with more detail and make it easier to diagnose issues. The changes are backward compatible and should not affect the functionality of the code. --- autogpt/speech/brian.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/autogpt/speech/brian.py b/autogpt/speech/brian.py index 821fdf2f4..b25b2ee27 100644 --- a/autogpt/speech/brian.py +++ b/autogpt/speech/brian.py @@ -1,12 +1,9 @@ -""" Brian speech module for autogpt """ import os - import requests +import logging from playsound import playsound - from autogpt.speech.base import VoiceBase - class BrianSpeech(VoiceBase): """Brian speech module for autogpt""" @@ -23,9 +20,7 @@ class BrianSpeech(VoiceBase): Returns: bool: True if the request was successful, False otherwise """ - tts_url = ( - f"https://api.streamelements.com/kappa/v2/speech?voice=Brian&text={text}" - ) + tts_url = f"https://api.streamelements.com/kappa/v2/speech?voice=Brian&text={text}" response = requests.get(tts_url) if response.status_code == 200: @@ -35,6 +30,5 @@ class BrianSpeech(VoiceBase): os.remove("speech.mp3") return True else: - print("Request failed with status code:", response.status_code) - print("Response content:", response.content) + logging.error("Request failed with status code: %s, response content: %s", response.status_code, response.content) return False