diff options
author | cbdev <cb@cbcdn.com> | 2019-12-20 21:29:18 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2019-12-20 21:29:18 +0100 |
commit | 062c93b1f718730c71bc4d2a1e53e0107dd236ad (patch) | |
tree | 85bb66190fd5d0f9b72090007904a34050bb5f68 /midimonster.h | |
parent | 5edccc6653eabe44079d82a7fbb96fd325b05177 (diff) | |
download | midimonster-062c93b1f718730c71bc4d2a1e53e0107dd236ad.tar.gz midimonster-062c93b1f718730c71bc4d2a1e53e0107dd236ad.tar.bz2 midimonster-062c93b1f718730c71bc4d2a1e53e0107dd236ad.zip |
Route all backend debug logging through a macro
Diffstat (limited to 'midimonster.h')
-rw-r--r-- | midimonster.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/midimonster.h b/midimonster.h index eb19409..5844bb9 100644 --- a/midimonster.h +++ b/midimonster.h @@ -10,6 +10,11 @@ #define MIDIMONSTER_VERSION "v0.3-dist" #endif +/* Set backend name if unset */ +#ifndef BACKEND_NAME + #define BACKEND_NAME "unspec" +#endif + /* API call attributes and visibilities */ #ifndef MM_API #ifdef _WIN32 @@ -37,13 +42,15 @@ /* Debug messages only compile in when DEBUG is set */ #ifdef DEBUG - #define DBGPF(format, ...) fprintf(stderr, (format), __VA_ARGS__) - #define DBG(message) fprintf(stderr, "%s", (message)) + #define DBGPF(format, ...) fprintf(stderr, "debug/%s\t" format "\n", (BACKEND_NAME), __VA_ARGS__) #else #define DBGPF(format, ...) - #define DBG(message) #endif +/* Log messages should be routed through these macros to ensure interoperability with different core implementations */ +#define LOGPF(format, ...) fprintf(stderr, "%s\t" format "\n", (BACKEND_NAME), __VA_ARGS__) +#define LOG(message) fprintf(stderr, "%s\t%s\n", (BACKEND_NAME), (message)) + /* Stop compilation if the build system reports an error */ #ifdef BUILD_ERROR #error The build system reported an error, compilation stopped. Refer to the invocation for this compilation unit for more information. |