Improve debug logs

This allows enabling debug logs per a compilation unit or via
compilation time defines.