Logging, a bug fix (guard logic) and a lazy val for performance

Changes only to the framework, no changes to the DSLs or tests.