| 1 | #ifndef BENCHMARK_COLORPRINT_H_ |
| 2 | #define BENCHMARK_COLORPRINT_H_ |
| 3 | |
| 4 | #include <cstdarg> |
| 5 | #include <iostream> |
| 6 | #include <string> |
| 7 | |
| 8 | namespace benchmark { |
| 9 | enum LogColor { |
| 10 | COLOR_DEFAULT, |
| 11 | COLOR_RED, |
| 12 | COLOR_GREEN, |
| 13 | COLOR_YELLOW, |
| 14 | COLOR_BLUE, |
| 15 | COLOR_MAGENTA, |
| 16 | COLOR_CYAN, |
| 17 | COLOR_WHITE |
| 18 | }; |
| 19 | |
| 20 | std::string FormatString(const char* msg, va_list args); |
| 21 | std::string FormatString(const char* msg, ...); |
| 22 | |
| 23 | void ColorPrintf(std::ostream& out, LogColor color, const char* fmt, |
| 24 | va_list args); |
| 25 | void ColorPrintf(std::ostream& out, LogColor color, const char* fmt, ...); |
| 26 | |
| 27 | // Returns true if stdout appears to be a terminal that supports colored |
| 28 | // output, false otherwise. |
| 29 | bool IsColorTerminal(); |
| 30 | |
| 31 | } // end namespace benchmark |
| 32 | |
| 33 | #endif // BENCHMARK_COLORPRINT_H_ |
| 34 | |