zoukankan      html  css  js  c++  java
  • debug

    /* debug masks (32 bits, non-overlapping) */
    #define D_BUG 0x00000001
    #define D_INFO 0x00000002
    #define D_WARNING 0x00000004
    #define D_ERROR 0x00000008
    #define D_FATAL 0x00000010

    #define __MSG__(mask) ((mask) & (__d_info__ | D_WARNING | D_ERROR | D_FATAL))
    || ((ylib_dbg & (mask)) && (ylib_sub & DBG_SUBSYS))

    #define D_MSG(mask, format, a...)
    do {
    if (__MSG__(mask)) {
    time_t __t = time(NULL);
    char __d_msg_buf[2 * 1024], __d_msg_time[128];
    strftime(__d_msg_time, 128, "%F %T", localtime(&__t));
    snprintf(__d_msg_buf, 2 * 1024,
    "%s[%lu]:%s:%d : %s( ):%6lu :%6lu: " format,
    __d_msg_time, (unsigned long)__t,
    __FILE__, __LINE__, __FUNCTION__,
    (unsigned long)getpid( ),
    (unsigned long)pthread_self( ), ##a);

    (void) ylog_write(__d_msg_buf);
    }
    } while (0);

    #define DINFO(format, a...) D_MSG(D_INFO, "INFO: "format, ## a)
    #define DWARN(format, a...) D_MSG(D_WARNING, "WARNING: "format, ## a)
    #define DERROR(format, a...) D_MSG(D_ERROR, "ERROR: "format, ## a)
    #define DFATAL(format, a...) D_MSG(D_FATAL, "FATAL: "format, ## a)

    #ifdef D_MSG_ON
    # define DBUG(format, a...) D_MSG(D_BUG, format, ## a)
    #else
    # define DBUG(format, a...) {}

  • 相关阅读:
    awk中NF的使用
    mysql5.7 column cannot be null
    mysqldump的简单使用
    mysql 删表引出的问题
    centos6.6 下安装mysql5.7
    从高的角度看自动化测试
    java提示找不到或无法加载主类
    修改chrome插件
    jenkins修改时区
    Rest-assured 写日志到 log4j
  • 原文地址:https://www.cnblogs.com/banwhui/p/5405413.html
Copyright © 2011-2022 走看看