From 2e0e1a402fab051e0b803406d65f47e485e5ea1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 14 Dec 2022 12:05:34 +0100 Subject: [PATCH] bar: also log module name when logging a failed module --- bar/bar.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/bar/bar.c b/bar/bar.c index ab9a587..10e0785 100644 --- a/bar/bar.c +++ b/bar/bar.c @@ -345,20 +345,29 @@ run(struct bar *_bar) int mod_ret; for (size_t i = 0; i < bar->left.count; i++) { thrd_join(thrd_left[i], &mod_ret); - if (mod_ret != 0) - LOG_ERR("module: LEFT #%zu: non-zero exit value: %d", i, mod_ret); + if (mod_ret != 0) { + const struct module *m = bar->left.mods[i]; + LOG_ERR("module: LEFT #%zu (%s): non-zero exit value: %d", + i, m->description(m), mod_ret); + } ret = ret == 0 && mod_ret != 0 ? mod_ret : ret; } for (size_t i = 0; i < bar->center.count; i++) { thrd_join(thrd_center[i], &mod_ret); - if (mod_ret != 0) - LOG_ERR("module: CENTER #%zu: non-zero exit value: %d", i, mod_ret); + if (mod_ret != 0) { + const struct module *m = bar->center.mods[i]; + LOG_ERR("module: CENTER #%zu (%s): non-zero exit value: %d", + i, m->description(m), mod_ret); + } ret = ret == 0 && mod_ret != 0 ? mod_ret : ret; } for (size_t i = 0; i < bar->right.count; i++) { thrd_join(thrd_right[i], &mod_ret); - if (mod_ret != 0) - LOG_ERR("module: RIGHT #%zu: non-zero exit value: %d", i, mod_ret); + if (mod_ret != 0) { + const struct module *m = bar->right.mods[i]; + LOG_ERR("module: RIGHT #%zu (%s): non-zero exit value: %d", + i, m->description(m), mod_ret); + } ret = ret == 0 && mod_ret != 0 ? mod_ret : ret; }