Chinaunix首页 | 论坛 | 博客
  • 博客访问: 120697
  • 博文数量: 22
  • 博客积分: 395
  • 博客等级: 下士
  • 技术积分: 228
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-28 13:39
文章分类

全部博文(22)

文章存档

2013年(2)

2012年(4)

2011年(16)

我的朋友

分类: C/C++

2011-09-06 17:01:54

print color:
  1. static const int DEBUG_LEVEL_COLORS[] = {
  2.     /*Errors Normal Info Detail Calls Detail2 Detail3 */
  3.     31/*red*/, 0/*normal*/, 32/*green*/, 33/*yellow*/, 36/*cyan*/, 35/*magenta*/, 4/*Underline*/};
  4. printf("\033[%dm", DEBUG_LEVEL_COLORS[0]);

  5. if (use_color)
  6.             printf("\033[0m");
----------------
print indent info:

DEBUG_CALLED("\"%s\"", remote_spec);
-----------
OCTEON_REMOTE:  Called octeon_remote_open("LINUX")
-----------
#define DEBUG_CALLED(format, ...) \
    remote_debug_call(0, "Called %s(" format ")\n", __FUNCTION__, ##__VA_ARGS__);


void debug_call(int is_return, const char *format, ...)
{
    if (3 <= remote_funcs.debug)
    {
        va_list args;
        if (is_return)
            remote_funcs.debug_indent--;
        printf("victor:%*s", (remote_funcs.debug_indent+1)*2, "");
        va_start(args, format);
        vprintf(format, args);
        va_end(args);
        if (!is_return)
            remote_funcs.debug_indent++;
    }
}

阅读(951) | 评论(0) | 转发(0) |
0

上一篇:git doc

下一篇:Linux进程优先级的调整方法

给主人留下些什么吧!~~