• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef BENCHMARK_LOG_H_
2 #define BENCHMARK_LOG_H_
3 
4 #include <ostream>
5 
6 namespace benchmark {
7 namespace internal {
8 
9 int GetLogLevel();
10 void SetLogLevel(int level);
11 
12 std::ostream& GetNullLogInstance();
13 std::ostream& GetErrorLogInstance();
14 
GetLogInstanceForLevel(int level)15 inline std::ostream& GetLogInstanceForLevel(int level) {
16   if (level <= GetLogLevel()) {
17     return GetErrorLogInstance();
18   }
19   return GetNullLogInstance();
20 }
21 
22 } // end namespace internal
23 } // end namespace benchmark
24 
25 #define VLOG(x) (::benchmark::internal::GetLogInstanceForLevel(x) \
26                  << "-- LOG(" << x << "): ")
27 
28 #endif