1 #include "log.h" 2 3 #include <iostream> 4 5 namespace benchmark { 6 namespace internal { 7 LoggingLevelImp()8int& LoggingLevelImp() { 9 static int level = 0; 10 return level; 11 } 12 SetLogLevel(int value)13void SetLogLevel(int value) { 14 LoggingLevelImp() = value; 15 } 16 GetLogLevel()17int GetLogLevel() { 18 return LoggingLevelImp(); 19 } 20 21 class NullLogBuffer : public std::streambuf 22 { 23 public: overflow(int c)24 int overflow(int c) { 25 return c; 26 } 27 }; 28 GetNullLogInstance()29std::ostream& GetNullLogInstance() { 30 static NullLogBuffer log_buff; 31 static std::ostream null_log(&log_buff); 32 return null_log; 33 } 34 GetErrorLogInstance()35std::ostream& GetErrorLogInstance() { 36 return std::clog; 37 } 38 39 } // end namespace internal 40 } // end namespace benchmark