diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-07-29 11:30:11 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-07-29 11:30:11 +0200 |
commit | e32a7a8d652ef5d8e1f59cd1a41586e64f3acf52 (patch) | |
tree | ae5a82b80f9572569f281b562983ec6b8a90fb27 | |
parent | 55bef12cda37490ad3555ca0dc724697241c33f1 (diff) |
make some errors into debug
With the debug and return value we can delay writing error messages
in the log until we really need to.
-rw-r--r-- | src/modules/spa/module-device-factory.c | 2 | ||||
-rw-r--r-- | src/modules/spa/spa-device.c | 6 | ||||
-rw-r--r-- | src/pipewire/pipewire.c | 27 | ||||
-rw-r--r-- | src/pipewire/private.h | 2 |
4 files changed, 17 insertions, 20 deletions
diff --git a/src/modules/spa/module-device-factory.c b/src/modules/spa/module-device-factory.c index ec7cc8f5..9396e5a8 100644 --- a/src/modules/spa/module-device-factory.c +++ b/src/modules/spa/module-device-factory.c @@ -164,7 +164,7 @@ error_properties: "usage: "FACTORY_USAGE); goto error_exit; error_device: - pw_log_error("can't create device: %s", spa_strerror(res)); + pw_log_debug("can't create device: %s", spa_strerror(res)); if (resource) pw_resource_errorf_id(resource, new_id, res, "can't create device: %s", spa_strerror(res)); diff --git a/src/modules/spa/spa-device.c b/src/modules/spa/spa-device.c index a1cc82e1..92d46bd6 100644 --- a/src/modules/spa/spa-device.c +++ b/src/modules/spa/spa-device.c @@ -141,15 +141,15 @@ struct pw_impl_device *pw_spa_device_load(struct pw_context *context, error_load: res = -errno; - pw_log_error("can't load device handle: %m"); + pw_log_debug("can't load device handle: %m"); goto error_exit; error_interface: - pw_log_error("can't get device interface %d", res); + pw_log_debug("can't get device interface %d", res); goto error_exit_unload; error_device: properties = NULL; res = -errno; - pw_log_error("can't create device: %m"); + pw_log_debug("can't create device: %m"); goto error_exit_unload; error_exit_unload: diff --git a/src/pipewire/pipewire.c b/src/pipewire/pipewire.c index 2fd90466..5471a948 100644 --- a/src/pipewire/pipewire.c +++ b/src/pipewire/pipewire.c @@ -93,8 +93,7 @@ find_plugin(struct registry *registry, const char *filename) static struct plugin * open_plugin(struct registry *registry, - const char *path, - const char *lib) + const char *path, const char *lib) { struct plugin *plugin; char *filename; @@ -115,12 +114,12 @@ open_plugin(struct registry *registry, if ((hnd = dlopen(filename, RTLD_NOW)) == NULL) { res = -ENOENT; - pw_log_error("can't load %s: %s", filename, dlerror()); + pw_log_debug("can't load %s: %s", filename, dlerror()); goto error_free_filename; } if ((enum_func = dlsym(hnd, SPA_HANDLE_FACTORY_ENUM_FUNC_NAME)) == NULL) { res = -ENOSYS; - pw_log_error("can't find enum function: %s", dlerror()); + pw_log_debug("can't find enum function: %s", dlerror()); goto error_dlclose; } @@ -184,7 +183,7 @@ static const struct spa_handle_factory *find_factory(struct plugin *plugin, cons } res = -ENOENT; out: - pw_log_error("can't find factory %s: %s", factory_name, spa_strerror(res)); + pw_log_debug("can't find factory %s: %s", factory_name, spa_strerror(res)); errno = -res; return NULL; } @@ -236,8 +235,8 @@ struct spa_handle *pw_load_spa_handle(const char *lib, struct support *sup = &global_support; struct plugin *plugin; struct handle *handle; - const struct spa_handle_factory *factory; - int res; + const struct spa_handle_factory *factory; + int res; if (factory_name == NULL) { res = -EINVAL; @@ -251,14 +250,12 @@ struct spa_handle *pw_load_spa_handle(const char *lib, if ((plugin = open_plugin(sup->registry, sup->plugin_dir, lib)) == NULL) { res = -errno; - pw_log_error("can't load '%s': %m", lib); goto error_out; } factory = find_factory(plugin, factory_name); if (factory == NULL) { res = -errno; - pw_log_error("can't find factory '%s': %m %s", factory_name, spa_strerror(res)); goto error_unref_plugin; } @@ -268,13 +265,13 @@ struct spa_handle *pw_load_spa_handle(const char *lib, goto error_unref_plugin; } - if ((res = spa_handle_factory_init(factory, - &handle->handle, info, - support, n_support)) < 0) { - pw_log_error("can't make factory instance '%s': %d (%s)", + if ((res = spa_handle_factory_init(factory, + &handle->handle, info, + support, n_support)) < 0) { + pw_log_debug("can't make factory instance '%s': %d (%s)", factory_name, res, spa_strerror(res)); - goto error_free_handle; - } + goto error_free_handle; + } handle->ref = 1; handle->plugin = plugin; diff --git a/src/pipewire/private.h b/src/pipewire/private.h index f5439692..27261c63 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -238,7 +238,7 @@ pw_core_resource_errorv(struct pw_resource *resource, uint32_t id, int seq, char buffer[1024]; vsnprintf(buffer, sizeof(buffer), message, args); buffer[1023] = '\0'; - pw_log_error("resource %p: id:%d seq:%d res:%d (%s) msg:\"%s\"", + pw_log_debug("resource %p: id:%d seq:%d res:%d (%s) msg:\"%s\"", resource, id, seq, res, spa_strerror(res), buffer); pw_core_resource_error(resource, id, seq, res, buffer); } |