blob: 59a4dfcbf292a7e869516323967c7aaf7886e7f4 [file] [log] [blame]
Michael Clarkf0d08882007-03-13 08:26:18 +00001/*
Michael Clark837240f2007-03-13 08:26:25 +00002 * $Id: debug.h,v 1.5 2006/01/30 23:07:57 mclark Exp $
Michael Clarkf0d08882007-03-13 08:26:18 +00003 *
Michael Clarkf6a6e482007-03-13 08:26:23 +00004 * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
Michael Clarkf0d08882007-03-13 08:26:18 +00005 * Michael Clark <michael@metaparadigm.com>
6 *
Michael Clarkf6a6e482007-03-13 08:26:23 +00007 * 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 Clarkf0d08882007-03-13 08:26:18 +00009 *
10 */
11
12#ifndef _DEBUG_H_
13#define _DEBUG_H_
14
Michael Clarkaaec1ef2009-02-25 02:31:32 +000015#ifdef __cplusplus
16extern "C" {
17#endif
18
Michael Clarkf0d08882007-03-13 08:26:18 +000019extern void mc_set_debug(int debug);
Michael Clark14862b12007-12-07 02:50:42 +000020extern int mc_get_debug(void);
Michael Clarkf0d08882007-03-13 08:26:18 +000021
22extern void mc_set_syslog(int syslog);
23extern void mc_abort(const char *msg, ...);
24extern void mc_debug(const char *msg, ...);
25extern void mc_error(const char *msg, ...);
26extern void mc_info(const char *msg, ...);
27
Michael Clarkdfaf6702007-10-25 02:26:00 +000028#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 Clarkaaec1ef2009-02-25 02:31:32 +000046#ifdef __cplusplus
47}
48#endif
49
Michael Clarkf0d08882007-03-13 08:26:18 +000050#endif