factor out logging: more detail and fix typo.