| Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 1 | /* |
| Michael Clark | 837240f | 2007-03-13 08:26:25 +0000 | [diff] [blame] | 2 | * $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $ |
| Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 3 | * |
| Michael Clark | f6a6e48 | 2007-03-13 08:26:23 +0000 | [diff] [blame] | 4 | * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. |
| Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 5 | * Michael Clark <michael@metaparadigm.com> |
| 6 | * |
| Michael Clark | f6a6e48 | 2007-03-13 08:26:23 +0000 | [diff] [blame] | 7 | * This library is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the MIT license. See COPYING for details. |
| Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 9 | * |
| 10 | */ |
| 11 | |
| 12 | #ifndef _DEBUG_H_ |
| 13 | #define _DEBUG_H_ |
| 14 | |
| Michael Clark | aaec1ef | 2009-02-25 02:31:32 +0000 | [diff] [blame^] | 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
| Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 19 | extern void mc_set_debug(int debug); |
| Michael Clark | 14862b1 | 2007-12-07 02:50:42 +0000 | [diff] [blame] | 20 | extern int mc_get_debug(void); |
| Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 21 | |
| 22 | extern void mc_set_syslog(int syslog); |
| 23 | extern void mc_abort(const char *msg, ...); |
| 24 | extern void mc_debug(const char *msg, ...); |
| 25 | extern void mc_error(const char *msg, ...); |
| 26 | extern void mc_info(const char *msg, ...); |
| 27 | |
| Michael Clark | dfaf670 | 2007-10-25 02:26:00 +0000 | [diff] [blame] | 28 | #ifdef MC_MAINTAINER_MODE |
| 29 | #define MC_SET_DEBUG(x) mc_set_debug(x) |
| 30 | #define MC_GET_DEBUG() mc_get_debug() |
| 31 | #define MC_SET_SYSLOG(x) mc_set_syslog(x) |
| 32 | #define MC_ABORT(x, ...) mc_abort(x, ##__VA_ARGS__) |
| 33 | #define MC_DEBUG(x, ...) mc_debug(x, ##__VA_ARGS__) |
| 34 | #define MC_ERROR(x, ...) mc_error(x, ##__VA_ARGS__) |
| 35 | #define MC_INFO(x, ...) mc_info(x, ##__VA_ARGS__) |
| 36 | #else |
| 37 | #define MC_SET_DEBUG(x) if (0) mc_set_debug(x) |
| 38 | #define MC_GET_DEBUG() (0) |
| 39 | #define MC_SET_SYSLOG(x) if (0) mc_set_syslog(x) |
| 40 | #define MC_ABORT(x, ...) if (0) mc_abort(x, ##__VA_ARGS__) |
| 41 | #define MC_DEBUG(x, ...) if (0) mc_debug(x, ##__VA_ARGS__) |
| 42 | #define MC_ERROR(x, ...) if (0) mc_error(x, ##__VA_ARGS__) |
| 43 | #define MC_INFO(x, ...) if (0) mc_info(x, ##__VA_ARGS__) |
| 44 | #endif |
| 45 | |
| Michael Clark | aaec1ef | 2009-02-25 02:31:32 +0000 | [diff] [blame^] | 46 | #ifdef __cplusplus |
| 47 | } |
| 48 | #endif |
| 49 | |
| Michael Clark | f0d0888 | 2007-03-13 08:26:18 +0000 | [diff] [blame] | 50 | #endif |