Skip to content

Commit

Permalink
add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
mscheltienne committed Dec 3, 2024
1 parent 32ff4ca commit 6f61332
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions stimuli/audio/backend/sounddevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion stimuli/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 6f61332

Please sign in to comment.