From f5be115791cb250fc5ced51f335ca639d79ab5e8 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 22 Sep 2016 22:34:00 +0200 Subject: [PATCH] src/aubio_priv.h: use new logging function --- src/aubio_priv.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/aubio_priv.h b/src/aubio_priv.h index ec62928d..e85231e2 100644 --- a/src/aubio_priv.h +++ b/src/aubio_priv.h @@ -172,16 +172,23 @@ typedef enum { AUBIO_FAIL = 1 } aubio_status; +/* Logging */ + +#include "utils/log.h" + +/** internal logging function, defined in utils/log.c */ +uint_t aubio_log(sint_t level, const char_t *fmt, ...); + #ifdef HAVE_C99_VARARGS_MACROS -#define AUBIO_ERR(...) fprintf(stderr, "AUBIO ERROR: " __VA_ARGS__) -#define AUBIO_MSG(...) fprintf(stdout, __VA_ARGS__) -#define AUBIO_DBG(...) fprintf(stderr, __VA_ARGS__) -#define AUBIO_WRN(...) fprintf(stderr, "AUBIO WARNING: " __VA_ARGS__) +#define AUBIO_ERR(...) aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " __VA_ARGS__) +#define AUBIO_MSG(...) aubio_log(AUBIO_LOG_MSG, __VA_ARGS__) +#define AUBIO_DBG(...) aubio_log(AUBIO_LOG_DBG, __VA_ARGS__) +#define AUBIO_WRN(...) aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " __VA_ARGS__) #else -#define AUBIO_ERR(format, args...) fprintf(stderr, "AUBIO ERROR: " format , ##args) -#define AUBIO_MSG(format, args...) fprintf(stdout, format , ##args) -#define AUBIO_DBG(format, args...) fprintf(stderr, format , ##args) -#define AUBIO_WRN(format, args...) fprintf(stderr, "AUBIO WARNING: " format, ##args) +#define AUBIO_ERR(format, args...) aubio_log(stderr, "AUBIO ERROR: " format , ##args) +#define AUBIO_MSG(format, args...) aubio_log(stdout, format , ##args) +#define AUBIO_DBG(format, args...) aubio_log(stderr, format , ##args) +#define AUBIO_WRN(format, args...) aubio_log(stderr, "AUBIO WARNING: " format, ##args) #endif #define AUBIO_ERROR AUBIO_ERR -- 2.11.0