optimised debug logging (issue #16)