Skip to content

Commit fac7cbb

Browse files
committed
Centralize trigger debug logging flag
Moves `DEBUG_TRIGGER_LOGS` into `config.py` so camera backends share a single toggle for trigger diagnostics. Basler now imports the shared flag instead of defining a local constant, and GenTL’s trigger-node dump is now guarded by both DEBUG log level and the config flag to avoid noisy logs unless explicitly enabled.
1 parent 03d73a6 commit fac7cbb

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

dlclivegui/cameras/backends/basler_backend.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import numpy as np
1111

12-
from ...config import BASLER_DO_LOG_TIMING, CameraTriggerSettings
12+
from ...config import BASLER_DO_LOG_TIMING, DEBUG_TRIGGER_LOGS, CameraTriggerSettings
1313
from ...utils.stats import WorkerTimingStats
1414
from ..base import CameraBackend, SupportLevel, register_backend
1515

@@ -31,8 +31,6 @@
3131
genicam = None # type: ignore[assignment]
3232
pylon = None # type: ignore[assignment]
3333

34-
DEBUG_TRIGGER_LOGS = False
35-
3634

3735
@register_backend("basler")
3836
class BaslerCameraBackend(CameraBackend):

dlclivegui/cameras/backends/gentl_backend.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import cv2
1313
import numpy as np
1414

15-
from ...config import CameraTriggerSettings
15+
from ...config import DEBUG_TRIGGER_LOGS, CameraTriggerSettings
1616
from ..base import CameraBackend, SupportLevel, register_backend
1717
from ..factory import DetectedCamera
1818
from .utils import gentl_discovery as cti_finder
@@ -199,6 +199,9 @@ def static_capabilities(cls) -> dict[str, SupportLevel]:
199199
}
200200

201201
def _debug_trigger_nodes(self, node_map, *, context: str = "") -> None:
202+
if not LOG.isEnabledFor(logging.DEBUG) or not DEBUG_TRIGGER_LOGS:
203+
return
204+
202205
names = (
203206
"TriggerMode",
204207
"TriggerSelector",

dlclivegui/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
SINGLE_CAMERA_WORKER_DO_LOG_TIMING: bool = False
2828
MULTI_CAMERA_WORKER_DO_LOG_TIMING: bool = False
2929
REC_DO_LOG_TIMING: bool = False
30+
### Trigger debug logging
31+
DEBUG_TRIGGER_LOGS = False
3032
# MAIN_WINDOW_DO_LOG_TIMING: bool = False
3133
#### Backends
3234
BASLER_DO_LOG_TIMING: bool = False

0 commit comments

Comments
 (0)