spa: add context to debug functions

Add new spa_debugc_ funnctions that take a context. The user should also
redefine the spa_debugc macro to handle the context.

Use this to let some plugins log the pod and format to the log without
using the global logger.

Also use this to remove our custom pod logger function by reusing the
spa one with a custom context.
This commit is contained in:
Wim Taymans 2023-01-18 13:09:00 +01:00
parent f472fd736d
commit 3c67821c4a
14 changed files with 158 additions and 268 deletions

View file

@ -38,11 +38,14 @@ extern "C" {
* \{
*/
#ifndef spa_debug
#define spa_debug(fmt,...) ({ printf((fmt"\n"), ## __VA_ARGS__); })
#endif
#ifndef spa_debugn
#define spa_debugn(fmt,...) ({ printf((fmt), ## __VA_ARGS__); })
#define spa_debugn(_fmt,...) printf((_fmt), ## __VA_ARGS__)
#endif
#ifndef spa_debug
#define spa_debug(_fmt,...) spa_debugn(_fmt"\n", ## __VA_ARGS__)
#endif
#ifndef spa_debugc
#define spa_debugc(_c,_fmt,...) spa_debug(_fmt, ## __VA_ARGS__)
#endif
struct spa_debug_buffer {