• DEBUG ZONE


    #include <stdio.h>
    #include <stdlib.h>
    #include <stdarg.h>
    /**
    *    COPYRIGHT NOTICE 
    *    Copyright (c) 2010, ffcs     (版权声明)  
    *    All rights reserved.  

    *   @file  Debug.h
    *   @brief 按DEBUG_ZONE输出调试消息
    *
    *   当宏DEBUG被打开时,根据设置的DEBUG_ZONE输出相应的消息。DEBUG_ZONE可以通过
    *   修改g_debug_setting的zone_mask修改。
    *
    *   @version v1.0
    *   @author  
    *   @date    2010/11/09
    *
    *   修订说明:
    *   2010/11/09      新作成
    */
    #ifndef __DEBUG_H__
    #define __DEBUG_H__
    #define DEBUG_ZONE_INFOPOINT     0
    #define DEBUG_ZONE_LOGMNG        1
    #define DEBUG_ZONE_INIT                        2
    #define DEBUG_ZONE_BASC_FTP_LOG        3

    #define ZONE_INFOPOINT_MSK    (1<<DEBUG_ZONE_INFOPOINT)
    #define ZONE_LOGMNG_MSK        (1<<DEBUG_ZONE_LOGMNG)
    #define ZONE_INIT_MSK                (1<<DEBUG_ZONE_INIT)
    #define ZONE_BASC_FTP_LOG_MSK (1<<DEBUG_ZONE_BASC_FTP_LOG)

    #define ZONE_INFOPOINT    (ZONE_INFOPOINT_MSK&g_debug_setting.zone_mask)
    #define ZONE_LOGMNG        (ZONE_LOGMNG_MSK&g_debug_setting.zone_mask)
    #define ZONE_INIT                (ZONE_INIT_MSK&g_debug_setting.zone_mask)
    #define ZONE_BASC_FTP_LOG (ZONE_BASC_FTP_LOG_MSK&g_debug_setting.zone_mask)

    #define DEBUGPRINT(switch,argv) ((switch)?DebugPrintf argv:((void)0))
    #ifdef DEBUG
    #define DEBUGMSG(switch,argv) DEBUGPRINT(switch,argv)
    #else
    #define DEBUGMSG(switch,argv) ((void*)0)
    #endif

    void DebugPrintf(char* pstr,...)
    {
        va_list vl;
        va_start(vl,pstr);
        vprintf(pstr,vl);
      va_end(vl);
    }
    typedef struct _DEBUG_PARAM
    {
        char module_name[30];
        char zones_name[16][32];
        unsigned zone_mask;
    }DEBUG_PARAM,*PDEBUG_PARAM;

    DEBUG_PARAM g_debug_setting=
    {
        "FTPtrans",
        {
            "infopoint",
            "logmng",
            "init",
            "basc_ftp_log",
        },
        ZONE_INFOPOINT_MSK|ZONE_LOGMNG_MSK
    };
    #endif
    /*
    int main()
    {
        DEBUGMSG(ZONE_INFOPOINT,("hello world!%d",9));
      return 0;
    }
    */
  • 相关阅读:
    494. Target Sum 添加标点符号求和
    636. Exclusive Time of Functions 进程的执行时间
    714. Best Time to Buy and Sell Stock with Transaction Fee有交易费的买卖股票
    377. Combination Sum IV 返回符合目标和的组数
    325. Maximum Size Subarray Sum Equals k 和等于k的最长子数组
    275. H-Index II 递增排序后的论文引用量
    274. H-Index论文引用量
    RabbitMQ学习之HelloWorld(1)
    java之struts2的数据处理
    java之struts2的action的创建方式
  • 原文地址:https://www.cnblogs.com/hbt19860104/p/2626395.html
Copyright © 2020-2023  润新知