spa: use log topics everywhere

Use log topics properly everywhere, convert from "#define NAME".
This commit is contained in:
Pauli Virtanen 2024-03-10 17:32:56 +02:00
parent c963ca47c1
commit e784de3933
27 changed files with 170 additions and 102 deletions

View file

@ -558,6 +558,8 @@ static const struct spa_handle_factory dbus_factory = {
impl_enum_interface_info,
};
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -6,9 +6,12 @@
#include <stdio.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
extern const struct spa_handle_factory spa_support_evl_system_factory;
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
{

View file

@ -24,7 +24,9 @@
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#define NAME "evl-system"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.evl-system");
#define MAX_POLL 512
@ -465,11 +467,11 @@ impl_init(const struct spa_handle_factory *factory,
impl->pid = getpid();
if ((res = evl_init()) < 0) {
spa_log_error(impl->log, NAME " %p: init failed: %s", impl, spa_strerror(res));
spa_log_error(impl->log, "%p: init failed: %s", impl, spa_strerror(res));
return res;
}
spa_log_info(impl->log, NAME " %p: initialized", impl);
spa_log_info(impl->log, "%p: initialized", impl);
return 0;
}

View file

@ -21,7 +21,9 @@
#include <systemd/sd-journal.h>
#define NAME "journal"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.journal");
#define DEFAULT_LOG_LEVEL SPA_LOG_LEVEL_INFO
@ -250,7 +252,7 @@ impl_init(const struct spa_handle_factory *factory,
else
impl->chain_log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
spa_log_debug(&impl->log, NAME " %p: initialized", impl);
spa_log_debug(&impl->log, "%p: initialized", impl);
return 0;
}
@ -289,6 +291,7 @@ static const struct spa_handle_factory journal_factory = {
.enum_interface_info = impl_enum_interface_info,
};
SPA_LOG_TOPIC_ENUM_DEFINE_REGISTERED;
SPA_EXPORT
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)

View file

@ -24,7 +24,9 @@
#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
#endif
#define NAME "logger"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.logger");
#define DEFAULT_LOG_LEVEL SPA_LOG_LEVEL_INFO
@ -357,7 +359,7 @@ impl_init(const struct spa_handle_factory *factory,
spa_ringbuffer_init(&this->trace_rb);
spa_log_debug(&this->log, NAME " %p: initialized to %s linebuf:%u", this, dest, linebuf);
spa_log_debug(&this->log, "%p: initialized to %s linebuf:%u", this, dest, linebuf);
return 0;
}

View file

@ -29,7 +29,9 @@
#include <spa/pod/filter.h>
#include <spa/control/control.h>
#define NAME "null-audio-sink"
#undef SPA_LOG_TOPIC_DEFAULT
#define SPA_LOG_TOPIC_DEFAULT &log_topic
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.null-audio-sink");
#define DEFAULT_CLOCK_NAME "clock.system.monotonic"
@ -227,7 +229,7 @@ static int reassign_follower(struct impl *this)
following = is_following(this);
if (following != this->following) {
spa_log_debug(this->log, NAME" %p: reassign follower %d->%d", this, this->following, following);
spa_log_debug(this->log, "%p: reassign follower %d->%d", this, this->following, following);
this->following = following;
spa_loop_invoke(this->data_loop, do_set_timers, 0, NULL, 0, true, this);
}
@ -274,7 +276,7 @@ static void on_timeout(struct spa_source *source)
if ((res = spa_system_timerfd_read(this->data_system,
this->timer_source.fd, &expirations)) < 0) {
if (res != -EAGAIN)
spa_log_error(this->log, NAME " %p: timerfd error: %s",
spa_log_error(this->log, "%p: timerfd error: %s",
this, spa_strerror(res));
return;
}
@ -573,7 +575,7 @@ impl_node_port_enum_params(void *object, int seq,
static int clear_buffers(struct impl *this, struct port *port)
{
if (port->n_buffers > 0) {
spa_log_info(this->log, NAME " %p: clear buffers", this);
spa_log_info(this->log, "%p: clear buffers", this);
port->n_buffers = 0;
this->started = false;
}
@ -728,7 +730,7 @@ impl_node_port_use_buffers(void *object,
b->outbuf = buffers[i];
if (d[0].data == NULL) {
spa_log_error(this->log, NAME " %p: invalid memory on buffer %p", this,
spa_log_error(this->log, "%p: invalid memory on buffer %p", this,
buffers[i]);
return -EINVAL;
}
@ -994,7 +996,7 @@ impl_init(const struct spa_handle_factory *factory,
if (this->props.n_pos > 0)
this->props.channels = this->props.n_pos;
spa_log_info(this->log, NAME " %p: initialized", this);
spa_log_info(this->log, "%p: initialized", this);
return 0;
}