log: dynamically load the logger API

This commit is contained in:
Wim Taymans 2017-06-06 16:53:16 +02:00
parent b4fdcbd322
commit 0af8377d10
14 changed files with 134 additions and 200 deletions

View file

@ -55,10 +55,6 @@ static inline void spa_log_impl_log(struct spa_log *log,
va_end(args);
}
static inline void spa_log_impl_set_loop(struct spa_log *log, struct spa_loop *loop)
{
}
#define SPA_LOG_IMPL_DEFINE(name) \
struct { \
struct spa_log log; \
@ -69,8 +65,7 @@ struct { \
NULL, \
SPA_LOG_LEVEL_INFO, \
spa_log_impl_log, \
spa_log_impl_logv, \
spa_log_impl_set_loop,} }
spa_log_impl_logv,} }
#define SPA_LOG_IMPL(name) \
SPA_LOG_IMPL_DEFINE(name) = SPA_LOG_IMPL_INIT

View file

@ -103,21 +103,8 @@ struct spa_log {
const char *func,
const char *fmt,
va_list args) SPA_PRINTF_FUNC(6, 0);
/**
* Set the loop for trace logging
* \param log the logger
* \param loop the loop for trace logging
*
* Trace logging will be done to a ringbuffer and written to
* the console/device from \a loop to ensure no blocking operations
* are done from the realtime thread.
*/
void (*set_loop) (struct spa_log *log,
struct spa_loop *loop);
};
#define spa_log_set_loop(l,...) (l)->set_loop((l),__VA_ARGS__)
#define spa_log_level_enabled(l,lev) ((l) && (l)->level >= (lev))
#if __STDC_VERSION__ >= 199901L