20#ifndef __CLSYNC_ERROR_H
21#define __CLSYNC_ERROR_H
23#define BACKTRACE_LENGTH 256
26# define DEBUGLEVEL_LIMIT 255
28# define DEBUGLEVEL_LIMIT 9
31extern void _critical (
const char *
const function_name,
const char *fmt, ... );
32#define critical(...) _critical(__func__, __VA_ARGS__)
33#define critical_on(cond) {debug(30, "critical_on: checking: %s", TOSTR(cond)); if (unlikely(cond)) {critical("Assert: "TOSTR(cond));}}
35extern void _error (
const char *
const function_name,
const char *fmt, ... );
36#define error(...) _error(__func__, __VA_ARGS__)
37#define error_on(cond) {if (unlikely(cond)) {error("Error: ("TOSTR(cond)") != 0");}}
39extern void _warning (
const char *
const function_name,
const char *fmt, ... );
40#define warning(...) _warning(__func__, __VA_ARGS__)
42extern void _info (
const char *
const function_name,
const char *fmt, ... );
43#define info(...) _info(__func__, __VA_ARGS__)
46extern void _debug (
int debug_level,
const char *
const function_name,
const char *fmt, ... );
47# define debug(debug_level, ...) {if (debug_level < DEBUGLEVEL_LIMIT) _debug(debug_level, __func__, __VA_ARGS__);}
48# define error_or_debug(debug_level, ...) ((debug_level)<0 ? _error(__func__, __VA_ARGS__) : _debug(debug_level, __func__, __VA_ARGS__))
50# define debug(debug_level, ...) {}
51# define error_or_debug(debug_level, ...) ((debug_level)<0 ? _error(__func__, __VA_ARGS__) : (void)0)
55#define debug_call(debug_level, code) debug(debug_level, "%s -> %i", TOSTR(code), code)
57#define critical_or_warning(cond, ...) ((cond) ? _critical : _warning)(__func__, __VA_ARGS__)
65extern void error_init (
void *_outputmethod,
int *_quiet,
int *_verbose,
int *_debug );
void _warning(const char *const function_name, const char *fmt,...)
void error_init(void *_outputmethod, int *_quiet, int *_verbose, int *_debug)
void _info(const char *const function_name, const char *fmt,...)
void error_init_ipc(ipc_type_t ipc_type)
void _critical(const char *const function_name, const char *fmt,...)
void _error(const char *const function_name, const char *fmt,...)
enum outputmethod outputmethod_t