- if (dbg_hit_cnt0)
- cerr << "Total " << dbg_hit_cnt0 << " Hit " << dbg_hit_cnt1
- << " hit rate (%) " << 100 * dbg_hit_cnt1 / dbg_hit_cnt0 << endl;
-}
+/// Our fancy logging facility. The trick here is to replace cin.rdbuf() and
+/// cout.rdbuf() with this one that tees cin and cout to a file stream. We can
+/// toggle the logging of std::cout and std:cin at runtime while preserving i/o
+/// functionality and without changing a single line of code!
+/// Idea from http://groups.google.com/group/comp.lang.c++/msg/1d941c0f26ea0d81