Add (smart) logging facility

By means of "Use Debug Log" UCI option it is possible to toggle
the logging of std::cout to file "out.txt" while preserving
the usual output to stdout. There is zero overhead when logging
is disabled and we achieved this without changing a single line
of exsisting code, in particular we still use std::cout as usual.

The idea and part of the code comes from this article:
http://groups.google.com/group/comp.lang.c++/msg/1d941c0f26ea0d81

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2012-03-18 03:20:43 +01:00
parent 2dfc94e0b6
commit eb28a683bd
3 changed files with 68 additions and 0 deletions

View File

@@ -60,4 +60,6 @@ private:
sys_time_t t;
};
extern void logger_set(bool b);
#endif // !defined(MISC_H_INCLUDED)