blob: 3777810e1c93dca3b172e3bfcf8d01f1b52ac454 [file] [log] [blame]
Eric Fiselierb08d8b12016-07-19 23:07:03 +00001#ifndef BENCHMARK_LOG_H_
2#define BENCHMARK_LOG_H_
3
4#include <ostream>
5
6namespace benchmark {
7namespace internal {
8
9int GetLogLevel();
10void SetLogLevel(int level);
11
12std::ostream& GetNullLogInstance();
13std::ostream& GetErrorLogInstance();
14
15inline 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