mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-21 14:44:36 +02:00
debug log in all cases and all non-data fields
This commit is contained in:
@@ -34,6 +34,7 @@ class BufferBinaryFormat(Structure):
|
||||
("data", c_byte * MODULE_N_BYTES)
|
||||
]
|
||||
|
||||
BUFFER_BINARY_NON_DATA = [n for n, _t in BufferBinaryFormat._fields_ if n != "data"]
|
||||
|
||||
BUFFER_BINARY_SIZE = sizeof(BufferBinaryFormat)
|
||||
|
||||
@@ -74,6 +75,10 @@ class BinaryBufferReader:
|
||||
input_data = input_file.read(n_bytes_to_read)
|
||||
frame_buffer = BufferBinaryFormat.from_buffer_copy(input_data)
|
||||
|
||||
non_data = {n: getattr(frame_buffer, n) for n in BUFFER_BINARY_NON_DATA}
|
||||
printable_non_data = ", ".join(f"{k}: {v}" for k, v in non_data.items())
|
||||
_logger.debug(f"{output_prefix} {printable_non_data}")
|
||||
|
||||
if frame_buffer.FORMAT_MARKER != BUFFER_FORMAT_MARKER:
|
||||
_logger.warning(f"{output_prefix} no data in buffer: {frame_buffer.FORMAT_MARKER} != {BUFFER_FORMAT_MARKER}")
|
||||
metadata["is_good_frame"] = False
|
||||
@@ -99,9 +104,6 @@ class BinaryBufferReader:
|
||||
"daq_rec": frame_buffer.daq_rec
|
||||
}
|
||||
|
||||
printable_current = ", ".join(f"{k}: {v}" for k, v in current.items())
|
||||
_logger.debug(f"{output_prefix} {printable_current}")
|
||||
|
||||
if not metadata_init:
|
||||
metadata.update(current)
|
||||
metadata_init = True
|
||||
|
||||
Reference in New Issue
Block a user