Debug logging I can compile-away in release

You might be interested in the scheme used by Logs for logging, see the links in this message.