mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-01-01 11:08:43 -05:00
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:
parent
f472fd736d
commit
3c67821c4a
14 changed files with 158 additions and 268 deletions
|
|
@ -37,16 +37,20 @@ extern "C" {
|
|||
#include <spa/debug/log.h>
|
||||
#include <spa/utils/dict.h>
|
||||
|
||||
static inline int spa_debug_dict(int indent, const struct spa_dict *dict)
|
||||
static inline int spa_debugc_dict(void *ctx, int indent, const struct spa_dict *dict)
|
||||
{
|
||||
const struct spa_dict_item *item;
|
||||
spa_debug("%*sflags:%08x n_items:%d", indent, "", dict->flags, dict->n_items);
|
||||
spa_debugc(ctx, "%*sflags:%08x n_items:%d", indent, "", dict->flags, dict->n_items);
|
||||
spa_dict_for_each(item, dict) {
|
||||
spa_debug("%*s %s = \"%s\"", indent, "", item->key, item->value);
|
||||
spa_debugc(ctx, "%*s %s = \"%s\"", indent, "", item->key, item->value);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int spa_debug_dict(int indent, const struct spa_dict *dict)
|
||||
{
|
||||
return spa_debugc_dict(NULL, indent, dict);
|
||||
}
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue