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