Replacing errors with logs