Add logging to generateHeartbeat