creates a LogRecord entry that retains a reference to the input arguments. In the case of a step running where the input is a DataModel this means the LogRecord will prevent the DataModel from being garbage collected.
As all LogRecords are assigned to Step._log_records this links the records to the Step instance so that all logs persist until the step is garbage collected.
From some debugging with @tapastro we found that: https://github.com/spacetelescope/stpipe/blob/9952c365458fc3f01839a912b62ab6c637dc9179/src/stpipe/step.py#L429
creates a
LogRecord
entry that retains a reference to the input arguments. In the case of a step running where the input is aDataModel
this means theLogRecord
will prevent theDataModel
from being garbage collected.As all
LogRecord
s are assigned toStep._log_records
this links the records to theStep
instance so that all logs persist until the step is garbage collected.