Chinaunix首页 | 论坛 | 博客
  • 博客访问: 899620
  • 博文数量: 194
  • 博客积分: 7991
  • 博客等级: 少将
  • 技术积分: 2067
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-09 22:03
文章分类

全部博文(194)

文章存档

2010年(8)

2009年(71)

2008年(109)

2007年(6)

我的朋友

分类: LINUX

2009-03-29 14:04:39

 

/* debug.h
 * debug macro - beta_debug(fmt, ...)
 * beta-song @ 2009-03-29
 */

#ifndef _beta_debug_h_
#define _beta_debug_h_

/* open this switch if you want to get some debug information */
#define BETA_DEBUG

/* open this switch if you want debug information show in syslog */
#define BETA_DEBUG_SYSLOG

/* debug macros */
#ifdef BETA_DEBUG
#ifdef BETA_DEBUG_SYSLOG
#include <syslog.h>
#define beta_debug(fmt, args...)    \
({\
    openlog("[beta debug]", LOG_PID | LOG_CONS, LOG_USER);\
    syslog(0, "%s->%s(), %d: "fmt"\n", __FILE__, __FUNCTION__, __LINE__, ##args);\
    closelog();\
})
#else
#include <stdio.h>
#define beta_debug(fmt, args...)    printf("[beta debug] %s->%s(), %d: "fmt"\n", __FILE__, __FUNCTION__, __LINE__, ##args)
#endif
#else
#define beta_debug(fmt, args...)
#endif

#endif /* !_beta_debug_h_ */

[from http://blog.chinaunix.net/u/8754/showart_1883627.html]

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

上一篇:AoE practice

下一篇:iSCSI Practice

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