日志想必都知道
优先级从高到低依次为:OFF、FATAL、ERROR、WARN、INFO、DEBUG、TRACE、 ALL
日志参考1
#define RED "\x1B[31m"
#define GRN "\x1B[32m"
#define YEL "\x1B[33m"
#define BLU "\x1B[34m"
#define MAG "\x1B[35m"
#define CYN "\x1B[36m"
#define WHT "\x1B[37m"
#define RESET "\x1B[0m"
const char log_color[][20] = {RED, RED, RED, YEL, GRN, MAG, ""};
int main() {
for(int i = 0; i < 6; i++){
printf("%s", log_color[i]);
printf("\nhello world.....\n");
}
return 0;
}
# 打印结果
hello world.....
hello world.....
hello world.....
hello world.....
hello world.....
hello world.....
才发现 复制粘贴不会有颜色 (蠢如我)