Add output logging logic.