Added maybe_log_item() for use by the sender and receiver.