Log forward pass preactivations

Is there a clean way to log the forward pass preactivations before every activation function? Something where you loop over the modules maybe. I don’t want to manually insert statements after each module.