aboutsummaryrefslogtreecommitdiff
path: root/src/log.h
blob: 3777810e1c93dca3b172e3bfcf8d01f1b52ac454 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef BENCHMARK_LOG_H_
#define BENCHMARK_LOG_H_

#include <ostream>

namespace benchmark {
namespace internal {

int GetLogLevel();
void SetLogLevel(int level);

std::ostream& GetNullLogInstance();
std::ostream& GetErrorLogInstance();

inline std::ostream& GetLogInstanceForLevel(int level) {
  if (level <= GetLogLevel()) {
    return GetErrorLogInstance();
  }
  return GetNullLogInstance();
}

} // end namespace internal
} // end namespace benchmark

#define VLOG(x) (::benchmark::internal::GetLogInstanceForLevel(x) \
                 << "-- LOG(" << x << "): ")

#endif