aboutsummaryrefslogtreecommitdiffhomepage
path: root/midimonster.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-07-01 23:07:17 +0200
committercbdev <cb@cbcdn.com>2021-07-01 23:07:17 +0200
commit7526e2b02716760a6ed05b6f35f7e5a67cebdb87 (patch)
tree2b072388046334e22a3017f0936e21463872e981 /midimonster.c
parentdfa4f916b62cbd20054ef7a677359e60eade14d1 (diff)
downloadmidimonster-7526e2b02716760a6ed05b6f35f7e5a67cebdb87.tar.gz
midimonster-7526e2b02716760a6ed05b6f35f7e5a67cebdb87.tar.bz2
midimonster-7526e2b02716760a6ed05b6f35f7e5a67cebdb87.zip
Route log output to frontend
Diffstat (limited to 'midimonster.c')
-rw-r--r--midimonster.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/midimonster.c b/midimonster.c
index 5e415e6..d00f116 100644
--- a/midimonster.c
+++ b/midimonster.c
@@ -1,5 +1,6 @@
#include <string.h>
#include <signal.h>
+#include <stdarg.h>
#ifndef _WIN32
#define MM_API __attribute__((visibility("default")))
#else
@@ -13,6 +14,16 @@
volatile static sig_atomic_t shutdown_requested = 0;
+MM_API int log_printf(int level, char* module, char* fmt, ...){
+ int rv = 0;
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stderr, "%s%s\t", level ? "debug/" : "", module);
+ rv = vfprintf(stderr, fmt, args);
+ va_end(args);
+ return rv;
+}
+
static void signal_handler(int signum){
shutdown_requested = 1;
}