src/aubio_priv.h: use new logging function
authorPaul Brossier <piem@piem.org>
Thu, 22 Sep 2016 20:34:00 +0000 (22:34 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 22 Sep 2016 20:34:00 +0000 (22:34 +0200)
src/aubio_priv.h

index ec62928..e85231e 100644 (file)
@@ -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