aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/util.c b/src/util.c
index c2663be..25a6bcd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -14,7 +14,8 @@
#include <stdio.h>
char warnlog[256];
-int loglevel = LOG_INFO;
+int log_level_min = LOG_INFO;
+int log_group_mask = LOG_ALL;
static void
__attribute__((format(printf, 1, 0)))
@@ -40,11 +41,17 @@ panic_task(const char *fmtstr, va_list ap, uint32_t sleep_ms)
}
void
-__attribute__ ((format (printf, 2, 3)))
-stdio_log(int level, const char *fmtstr, ...)
+__attribute__ ((format (printf, 3, 4)))
+stdio_log(int facility, int level, const char *fmtstr, ...)
{
va_list ap, cpy;
+ if (!(facility & log_group_mask))
+ return;
+
+ if (level < log_level_min)
+ return;
+
if (level == LOG_WARN) {
led_start_blip(HARD_RED, 100);
va_copy(cpy, ap);
@@ -56,9 +63,6 @@ stdio_log(int level, const char *fmtstr, ...)
split_warn_master(warnlog);
}
- if (level > loglevel)
- return;
-
if (!tud_cdc_connected())
return;