Adding reason code to logs. Closes #7