Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1287 from DiamondLightSource/initialise_dodal_log…
Browse files Browse the repository at this point in the history
…gers_in_callbacks

Initialise dodal logger in external callbacks
  • Loading branch information
d-perl authored Mar 28, 2024
2 parents 6c251a6 + f4a5a5a commit bb69923
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hyperion/external_interaction/callbacks/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Callable, Sequence

from bluesky.callbacks.zmq import Proxy, RemoteDispatcher
from dodal.log import LOGGER as dodal_logger
from dodal.log import set_up_all_logging_handlers

from hyperion.external_interaction.callbacks.log_uid_tag_callback import (
Expand Down Expand Up @@ -65,6 +66,7 @@ def setup_logging(dev_mode: bool):
log_info(f"Loggers initialised with dev_mode={dev_mode}")
nexgen_logger = logging.getLogger("nexgen")
nexgen_logger.parent = NEXUS_LOGGER
dodal_logger.parent = ISPYB_LOGGER
log_debug("nexgen logger added to nexus logger")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytest
from bluesky.callbacks.zmq import Proxy, RemoteDispatcher
from dodal.log import LOGGER as DODAL_LOGGER

from hyperion.external_interaction.callbacks.__main__ import (
main,
Expand Down Expand Up @@ -49,11 +50,13 @@ def test_setup_callbacks():
return_value=True,
)
def test_setup_logging(parse_callback_cli_args):
assert DODAL_LOGGER.parent != ISPYB_LOGGER
assert len(ISPYB_LOGGER.handlers) == 0
assert len(NEXUS_LOGGER.handlers) == 0
setup_logging(parse_callback_cli_args())
assert len(ISPYB_LOGGER.handlers) == 4
assert len(NEXUS_LOGGER.handlers) == 4
assert DODAL_LOGGER.parent == ISPYB_LOGGER
setup_logging(parse_callback_cli_args())
assert len(ISPYB_LOGGER.handlers) == 4
assert len(NEXUS_LOGGER.handlers) == 4
Expand Down

0 comments on commit bb69923

Please sign in to comment.