-/// Our fancy logging facility. The trick here is to replace cout.rdbuf() with
-/// this one that sends the output both to console and to a file, this allow us
-/// to toggle the logging of std::cout to a file while preserving output to
-/// stdout and without changing a single line of code! Idea and code from:
-/// http://groups.google.com/group/comp.lang.c++/msg/1d941c0f26ea0d81
-
-class Tee: public streambuf {
-public:
- typedef char_traits<char> traits_type;
- typedef traits_type::int_type int_type;
-
- Tee(ios& s, ofstream& f) : stream(s), file(f), stream_buf(s.rdbuf()) {}
- ~Tee() { set(false); }
-
- void set(bool b) { stream.rdbuf(b ? this : stream_buf); }
+/// Our fancy logging facility. The trick here is to replace cin.rdbuf() and
+/// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We
+/// can toggle the logging of std::cout and std:cin at runtime while preserving
+/// usual i/o functionality and without changing a single line of code!
+/// Idea from http://groups.google.com/group/comp.lang.c++/msg/1d941c0f26ea0d81