Skip to content

Commit 92d6d11

Browse files
committed
logging debug
1 parent 4f81a8d commit 92d6d11

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

GEECS-Scanner-GUI/geecs_scanner/data_acquisition/data_logger.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,14 +1329,7 @@ def _log_device_data(self, device: GeecsDevice, elapsed_time: float) -> None:
13291329
self.sound_player.play_beep() # Play the beep sound
13301330
self.shot_index += 1
13311331
# Stamp the current shot number into the logging context
1332-
update_context(
1333-
{
1334-
"scan_id": getattr(
1335-
self, "scan_number", "-"
1336-
), # or pass it in from ScanManager
1337-
"shot_id": str(self.shot_index),
1338-
}
1339-
)
1332+
update_context({"shot_id": str(self.shot_index)})
13401333

13411334
self.log_entries[elapsed_time].update(
13421335
{

GEECS-Scanner-GUI/geecs_scanner/logging_setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,16 @@ def init_logging(
193193
_QUEUE = Queue(-1)
194194
root = logging.getLogger()
195195
root.setLevel(level)
196-
root.handlers[:] = [logging.handlers.QueueHandler(_QUEUE)]
196+
qh = logging.handlers.QueueHandler(_QUEUE)
197+
root.handlers[:] = [qh]
198+
# One shared ContextFilter; apply at handler level so *all* records get i
197199
global _CTX_FILTER
198200
_CTX_FILTER = ContextFilter(**(base_context or {"scan_id": "-", "shot_id": "-"}))
199-
# Don't clear other filters; just add ours
200-
root.addFilter(_CTX_FILTER)
201+
qh.addFilter(_CTX_FILTER) # inject before enqueue
201202

202203
# Multiplexer for real sinks
203204
_MUX = MultiplexingHandler()
205+
_MUX.addFilter(_CTX_FILTER) # inject in listener thread before fan-out
204206

205207
# Global rotating file
206208
gf = logging.handlers.RotatingFileHandler(

0 commit comments

Comments
 (0)