From 0de534d3bc30ff538801cc71324fd4139a31eafc Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 20 Jun 2021 12:54:09 +0200 Subject: [PATCH] Attempt to log message only in verbose mode If the log level is not verbose, there is no need to attept to log control messages at all. --- app/src/controller.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/controller.c b/app/src/controller.c index 9284ae526d..3a428aa865 100644 --- a/app/src/controller.c +++ b/app/src/controller.c @@ -48,7 +48,10 @@ controller_destroy(struct controller *controller) { bool controller_push_msg(struct controller *controller, const struct control_msg *msg) { - control_msg_log(msg); + if (sc_get_log_level() <= SC_LOG_LEVEL_VERBOSE) { + control_msg_log(msg); + } + sc_mutex_lock(&controller->mutex); bool was_empty = cbuf_is_empty(&controller->queue); bool res = cbuf_push(&controller->queue, *msg);