Commit 605e6e1c 605e6e1c05fd26a946f68414475bba56998f252f by Sam Roberts

Added level argument of mu_debug_print() to the print callback, useful

for determing the level and forwarding to syslog, or something.
1 parent 295f62a9
......@@ -36,8 +36,10 @@ extern "C" {
struct _debug;
typedef struct _debug* mu_debug_t;
#define MU_DEBUG_TRACE 1
#define MU_DEBUG_PROT 2
#define MU_DEBUG_ERROR 1
#define MU_DEBUG_TRACE 2
#define MU_DEBUG_PROT 3
extern int mu_debug_create __P ((mu_debug_t *, void *owner));
extern void mu_debug_destroy __P ((mu_debug_t *, void *owner));
extern void * mu_debug_get_owner __P ((mu_debug_t));
......@@ -47,7 +49,7 @@ extern int mu_debug_print __P ((mu_debug_t debug, size_t level,
const char *format, ...));
extern int mu_debug_printv __P ((mu_debug_t debug, size_t level,
const char *format, va_list argp));
extern int mu_debug_set_print __P ((mu_debug_t, int (*_print) __P ((mu_debug_t, const char *, va_list)), void *owner));
extern int mu_debug_set_print __P ((mu_debug_t, int (*_print) __P ((mu_debug_t, size_t level, const char *, va_list)), void *owner));
#ifdef __cplusplus
}
......
......@@ -80,8 +80,9 @@ mu_debug_get_level (mu_debug_t debug, size_t *plevel)
}
int
mu_debug_set_print (mu_debug_t debug, int (*_print)
__P ((mu_debug_t, const char *, va_list)), void *owner)
mu_debug_set_print (mu_debug_t debug,
int (*_print) __P ((mu_debug_t, size_t, const char *, va_list)),
void *owner)
{
if (debug == NULL)
return EINVAL;
......@@ -115,7 +116,7 @@ mu_debug_printv (mu_debug_t debug, size_t level, const char *format, va_list ap)
return 0;
if (debug->_print)
debug->_print (debug, format, ap);
debug->_print (debug, level, format, ap);
else
vfprintf (stderr, format, ap);
......
......@@ -42,7 +42,7 @@ struct _debug
char *buffer;
size_t buflen;
void *owner;
int (*_print) __P ((mu_debug_t, const char *, va_list));
int (*_print) __P ((mu_debug_t, size_t level, const char *, va_list));
};
#ifdef __cplusplus
......