Skip to content

Commit d983305

Browse files
zhansheng.lzsclaude
andcommitted
fix: downgrade redundant logger.error(e) to debug in audio modules
The SDK's exception handlers were logging exceptions at error level before re-raising, causing duplicate logs in user applications. Following PR #68 discussion, downgrade to debug level across audio/asr, audio/qwen_asr, and audio/tts_v2 modules. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 687834c commit d983305

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

dashscope/audio/asr/recognition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def call( # type: ignore[override] # noqa: E501
444444
f.close()
445445
self._stop_stream_timestamp = time.time() * 1000
446446
except Exception as e:
447-
logger.error(e)
447+
logger.debug(e)
448448
raise e
449449

450450
if not self._stream_data.empty():

dashscope/audio/asr/transcription.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def fetch(
149149
**kwargs,
150150
)
151151
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
152-
logger.error(e)
152+
logger.debug(e)
153153
try_count += 1
154154
if try_count <= Transcription.MAX_QUERY_TRY_COUNT:
155155
time.sleep(2)
@@ -231,7 +231,7 @@ def _launch_request(
231231
**kwargs,
232232
)
233233
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
234-
logger.error(e)
234+
logger.debug(e)
235235
try_count += 1
236236
if try_count <= Transcription.MAX_QUERY_TRY_COUNT:
237237
time.sleep(2)

dashscope/audio/asr/translation_recognizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ def call( # type: ignore[override]
582582
f.close()
583583
self._stop_stream_timestamp = time.time() * 1000
584584
except Exception as e:
585-
logger.error(e)
585+
logger.debug(e)
586586
raise e
587587

588588
if not self._stream_data.empty():

dashscope/audio/asr/vocabulary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __call_with_input(self, input): # pylint: disable=redefined-builtin
6969
**self._kwargs,
7070
)
7171
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
72-
logger.error(e)
72+
logger.debug(e)
7373
try_count += 1
7474
if try_count <= VocabularyService.MAX_QUERY_TRY_COUNT:
7575
time.sleep(2)

dashscope/audio/qwen_asr/qwen_transcription.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def fetch(
109109
**kwargs,
110110
)
111111
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
112-
logger.error(e)
112+
logger.debug(e)
113113
try_count += 1
114114
if try_count <= QwenTranscription.MAX_QUERY_TRY_COUNT:
115115
time.sleep(2)
@@ -187,7 +187,7 @@ def _launch_request(
187187
**kwargs,
188188
)
189189
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
190-
logger.error(e)
190+
logger.debug(e)
191191
try_count += 1
192192
if try_count <= QwenTranscription.MAX_QUERY_TRY_COUNT:
193193
time.sleep(2)

dashscope/audio/tts_v2/enrollment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def __call_with_input( # pylint: disable=redefined-builtin
7272
**self._kwargs,
7373
)
7474
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
75-
logger.error(e)
75+
logger.debug(e)
7676
try_count += 1
7777
if try_count <= VoiceEnrollmentService.MAX_QUERY_TRY_COUNT:
7878
time.sleep(2)

0 commit comments

Comments
 (0)