From 2f0c0610be307dc23d7130b72fc80ee75ea0229a Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Wed, 11 Feb 2026 16:49:36 +0000 Subject: [PATCH 1/2] Add logging around global path provider use --- src/dodal/common/beamlines/beamline_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dodal/common/beamlines/beamline_utils.py b/src/dodal/common/beamlines/beamline_utils.py index c543d250d8..276a0fb2d9 100644 --- a/src/dodal/common/beamlines/beamline_utils.py +++ b/src/dodal/common/beamlines/beamline_utils.py @@ -1,4 +1,5 @@ import inspect +import logging from collections.abc import Callable from typing import Annotated, Final, TypeVar, cast @@ -26,6 +27,9 @@ BL = "" +LOGGER = logging.getLogger(__name__) + + def set_beamline(beamline: str): global BL BL = beamline @@ -162,6 +166,11 @@ def decorator(factory: Callable[[], T]) -> DeviceInitializationController[T]: def set_path_provider(provider: PathProvider): global PATH_PROVIDER + LOGGER.info( + "Setting global path provider to %s (previously %s)", + provider, + globals().get("PATH_PROVIDER"), + ) PATH_PROVIDER = provider @@ -171,6 +180,7 @@ def get_path_provider() -> PathProvider: def clear_path_provider() -> None: global PATH_PROVIDER + LOGGER.info("Clearing global path provider: %s", globals().get("PATH_PROVIDER")) try: del PATH_PROVIDER except NameError: From 1a5066368b74050eecbd5ce615a2ddd8189bc1bc Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Tue, 17 Feb 2026 10:18:59 +0000 Subject: [PATCH 2/2] Use central dodal logger --- src/dodal/common/beamlines/beamline_utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/dodal/common/beamlines/beamline_utils.py b/src/dodal/common/beamlines/beamline_utils.py index 276a0fb2d9..59f5cc9dbb 100644 --- a/src/dodal/common/beamlines/beamline_utils.py +++ b/src/dodal/common/beamlines/beamline_utils.py @@ -1,5 +1,4 @@ import inspect -import logging from collections.abc import Callable from typing import Annotated, Final, TypeVar, cast @@ -13,6 +12,7 @@ from ophyd_async.core import Device as OphydV2Device from ophyd_async.core import wait_for_connection as v2_device_wait_for_connection +from dodal.log import LOGGER from dodal.utils import ( AnyDevice, BeamlinePrefix, @@ -27,9 +27,6 @@ BL = "" -LOGGER = logging.getLogger(__name__) - - def set_beamline(beamline: str): global BL BL = beamline