Do all input validation first, then log (which can fail). If all goes swimmingly, process the transaction.