diff options
author | Chris Robinson <[email protected]> | 2017-06-30 17:22:15 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-06-30 17:22:15 -0700 |
commit | 32bda7b94c95f4f83a5c329c415d4dc14e099c03 (patch) | |
tree | accb1899ceefb4d42157855518b2774bf8c7e77a /router/router.h | |
parent | 77e317609b3a879a8fb3970ecc7d347c09a7a528 (diff) |
Add tracing capabilities to the router
Diffstat (limited to 'router/router.h')
-rw-r--r-- | router/router.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/router/router.h b/router/router.h index 1eef017f..7cc94399 100644 --- a/router/router.h +++ b/router/router.h @@ -5,6 +5,8 @@ #include <windows.h> #include <winnt.h> +#include <stdio.h> + #include "AL/alc.h" #include "AL/al.h" #include "atomic.h" @@ -156,4 +158,27 @@ extern almtx_t ContextSwitchLock; void ReleaseALC(void); + +enum LogLevel { + LogLevel_None = 0, + LogLevel_Error = 1, + LogLevel_Warn = 2, + LogLevel_Trace = 3, +}; +extern enum LogLevel LogLevel; +extern FILE *LogFile; + +#define TRACE(...) do { \ + if(LogLevel >= LogLevel_Trace) \ + fprintf(LogFile, "AL Router (II): " __VA_ARGS__); \ +} while(0) +#define WARN(...) do { \ + if(LogLevel >= LogLevel_Warn) \ + fprintf(LogFile, "AL Router (WW): " __VA_ARGS__); \ +} while(0) +#define ERR(...) do { \ + if(LogLevel >= LogLevel_Error) \ + fprintf(LogFile, "AL Router (EE): " __VA_ARGS__); \ +} while(0) + #endif /* ROUTER_ROUTER_H */ |