1 #ifndef BENCHMARK_LOG_H_ 2 #define BENCHMARK_LOG_H_ 10 #if __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) 11 #define BENCHMARK_HAS_CXX11 17 typedef std::basic_ostream<char>&(EndLType)(std::basic_ostream<char>&);
20 friend LogType& GetNullLogInstance();
21 friend LogType& GetErrorLogInstance();
29 LogType(std::ostream* out) : out_(out) {}
34 #ifndef BENCHMARK_HAS_CXX11 51 inline LogType& operator<<(LogType& log, EndLType* m) {
58 inline int& LogLevel() {
59 static int log_level = 0;
63 inline LogType& GetNullLogInstance() {
64 static LogType null_log(static_cast<std::ostream*>(
nullptr));
68 inline LogType& GetErrorLogInstance() {
69 static LogType error_log(&std::clog);
73 inline LogType& GetLogInstanceForLevel(
int level) {
74 if (level <= LogLevel()) {
75 return GetErrorLogInstance();
77 return GetNullLogInstance();
85 (::benchmark::internal::GetLogInstanceForLevel(x) << "-- LOG(" << x << "):" \ Definition: benchmark.h:338