1 #ifndef BENCHMARK_LOG_H_
2 #define BENCHMARK_LOG_H_
7 #include "benchmark/benchmark.h"
12 typedef std::basic_ostream<char>&(EndLType)(std::basic_ostream<char>&);
15 friend LogType& GetNullLogInstance();
16 friend LogType& GetErrorLogInstance();
24 LogType(std::ostream* out) : out_(out) {}
26 BENCHMARK_DISALLOW_COPY_AND_ASSIGN(
LogType);
37 inline LogType& operator<<(LogType& log, EndLType* m) {
44 inline int& LogLevel() {
45 static int log_level = 0;
49 inline LogType& GetNullLogInstance() {
50 static LogType log(
nullptr);
54 inline LogType& GetErrorLogInstance() {
55 static LogType log(&std::clog);
59 inline LogType& GetLogInstanceForLevel(
int level) {
60 if (level <= LogLevel()) {
61 return GetErrorLogInstance();
63 return GetNullLogInstance();
71 (::benchmark::internal::GetLogInstanceForLevel(x) << "-- LOG(" << x << "):" \