spa: add debug log context

Make a real debug context with a log function and move it to a new file.
This way we don't need to redefine a macro.
Make a new context for debugging to a log file. Make new functions to
debug to a log file.
Move the stringbuffer to string utils.
Integrate file/line/func and topics into the debug log.
We can remove some more things from the pipewire log_object function and
also add support for topics.
This commit is contained in:
Wim Taymans 2023-01-18 17:41:16 +01:00
parent 3c67821c4a
commit 6207d98ff1
21 changed files with 231 additions and 164 deletions

View file

@ -48,10 +48,8 @@
#include <spa/param/audio/raw.h>
#include <spa/param/bluetooth/audio.h>
#include <spa/param/bluetooth/type-info.h>
#undef spa_debugc
#define spa_debugc(l,...) spa_log_debug(l, __VA_ARGS__)
#include <spa/debug/pod.h>
#include <spa/debug/log.h>
#include "defs.h"
#include "media-codecs.h"
@ -2117,7 +2115,7 @@ static int impl_set_param(void *object,
SPA_PARAM_PROFILE_index, SPA_POD_Int(&idx),
SPA_PARAM_PROFILE_save, SPA_POD_OPT_Bool(&save))) < 0) {
spa_log_warn(this->log, "can't parse profile");
spa_debugc_pod(this->log, 0, NULL, param);
spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
return res;
}
@ -2145,7 +2143,7 @@ static int impl_set_param(void *object,
SPA_PARAM_ROUTE_props, SPA_POD_OPT_Pod(&props),
SPA_PARAM_ROUTE_save, SPA_POD_OPT_Bool(&save))) < 0) {
spa_log_warn(this->log, "can't parse route");
spa_debugc_pod(this->log, 0, NULL, param);
spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
return res;
}
if (device > 1 || !this->nodes[device].active)
@ -2176,7 +2174,7 @@ static int impl_set_param(void *object,
SPA_PROP_bluetoothAudioCodec, SPA_POD_OPT_Id(&codec_id),
SPA_PROP_bluetoothOffloadActive, SPA_POD_OPT_Bool(&offload_active))) < 0) {
spa_log_warn(this->log, "can't parse props");
spa_debugc_pod(this->log, 0, NULL, param);
spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
return res;
}