From 6f6133224682451fc0ed06f9843580c580e194df Mon Sep 17 00:00:00 2001 From: Mathieu Scheltienne Date: Tue, 3 Dec 2024 11:19:33 +0100 Subject: [PATCH] add debug log --- stimuli/audio/backend/sounddevice.py | 6 ++++-- stimuli/conftest.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/stimuli/audio/backend/sounddevice.py b/stimuli/audio/backend/sounddevice.py index 7998515..ec73476 100644 --- a/stimuli/audio/backend/sounddevice.py +++ b/stimuli/audio/backend/sounddevice.py @@ -7,7 +7,7 @@ from ...time import Clock, sleep from ...utils._checks import check_value, ensure_int from ...utils._docs import copy_doc, fill_doc -from ...utils.logs import warn +from ...utils.logs import logger, warn from ._base import BaseBackend if TYPE_CHECKING: @@ -164,7 +164,9 @@ def _ensure_device(device: int | None) -> dict[str, str | int | float]: """Ensure the device argument is valid.""" if device is None: idx = sd.default.device["output"] - return sd.query_devices()[idx] + devices = sd.query_devices() + logger.debug("Selected device: %s\nAvailable devices\n%s", idx, devices) + return devices[idx] device_idx = ensure_int(device, "device") devices = sd.query_devices() if len(devices) <= device_idx: diff --git a/stimuli/conftest.py b/stimuli/conftest.py index 89d85e1..672dfa8 100644 --- a/stimuli/conftest.py +++ b/stimuli/conftest.py @@ -2,7 +2,8 @@ from typing import TYPE_CHECKING -from .utils.logs import logger +from stimuli import set_log_level +from stimuli.utils.logs import logger if TYPE_CHECKING: import pytest @@ -20,4 +21,5 @@ def pytest_configure(config: pytest.Config) -> None: if warning_line and not warning_line.startswith("#"): config.addinivalue_line("filterwarnings", warning_line) # setup logging + set_log_level("DEBUG") logger.propagate = True