Add logging operation
Reinstate the accidentally removed cache, add email-on error

Also fixes the inclusion of the materialize code
Ignore the dist directories