title: Custom Debug printf Used at Runtime
body: <p>For awhile I've used something like the following to do my debugging.</p>
  
  <pre><code>#ifdef DEBUG
  #       define Log(fmt, ...) printf(("[%s:%d] %s: " fmt "\n"), __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__);
  #else
  #       define Log(...)
  #endif
  </code></pre>
  
  <p>This works fine such that when I compile with something like <code>g++ -DDEBUG=1</code>, I get all the prints I expect.</p>
  
  <p>My question (or challenge) is to come up with a way that this debugging can occur with a runtime command instead of build time (e.g. <code>./myprocess -d</code>) without complicating (or really changing at all) the client side code.</p>