Skip to content

Commit

Permalink
Attempt to log message only in verbose mode
Browse files Browse the repository at this point in the history
If the log level is not verbose, there is no need to attept to log
control messages at all.
  • Loading branch information
rom1v committed Jun 20, 2021
1 parent 4eb8f6c commit 3671e55
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/src/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3671e55

Please sign in to comment.