Commit 7af2ce25 authored by David Reid's avatar David Reid

Make log levels an enum instead of defines.

parent ce0d8f84
...@@ -646,8 +646,7 @@ You cannot use `-std=c*` compiler flags, nor `-ansi`. ...@@ -646,8 +646,7 @@ You cannot use `-std=c*` compiler flags, nor `-ansi`.
| | You may need to enable this if your target platform does not allow | | | You may need to enable this if your target platform does not allow |
| | runtime linking via `dlopen()`. | | | runtime linking via `dlopen()`. |
+----------------------------------+--------------------------------------------------------------------+ +----------------------------------+--------------------------------------------------------------------+
| MA_DEBUG_OUTPUT | Enable processing of `MA_LOG_LEVEL_DEBUG` messages and `printf()` | | MA_DEBUG_OUTPUT | Enable `printf()` output of debug logs (`MA_LOG_LEVEL_DEBUG`). |
| | output. |
+----------------------------------+--------------------------------------------------------------------+ +----------------------------------+--------------------------------------------------------------------+
| MA_COINIT_VALUE | Windows only. The value to pass to internal calls to | | MA_COINIT_VALUE | Windows only. The value to pass to internal calls to |
| | `CoInitializeEx()`. Defaults to `COINIT_MULTITHREADED`. | | | `CoInitializeEx()`. Defaults to `COINIT_MULTITHREADED`. |
...@@ -3858,10 +3857,13 @@ MA_LOG_LEVEL_ERROR ...@@ -3858,10 +3857,13 @@ MA_LOG_LEVEL_ERROR
be fired from within the data callback, in which case the device will be stopped. You should be fired from within the data callback, in which case the device will be stopped. You should
always have this log level enabled. always have this log level enabled.
*/ */
#define MA_LOG_LEVEL_DEBUG 4 typedef enum
#define MA_LOG_LEVEL_INFO 3 {
#define MA_LOG_LEVEL_WARNING 2 MA_LOG_LEVEL_DEBUG = 4,
#define MA_LOG_LEVEL_ERROR 1 MA_LOG_LEVEL_INFO = 3,
MA_LOG_LEVEL_WARNING = 2,
MA_LOG_LEVEL_ERROR = 1
} ma_log_level;
/* /*
Variables needing to be accessed atomically should be declared with this macro for two reasons: Variables needing to be accessed atomically should be declared with this macro for two reasons:
...@@ -12943,18 +12945,6 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat ...@@ -12943,18 +12945,6 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat
return MA_INVALID_ARGS; return MA_INVALID_ARGS;
} }
/*
If it's a debug log, ignore it unless MA_DEBUG_OUTPUT is enabled. Do this before generating the
formatted message string so that we don't waste time only to have ma_log_post() reject it.
*/
#if !defined(MA_DEBUG_OUTPUT)
{
if (level == MA_LOG_LEVEL_DEBUG) {
return MA_INVALID_ARGS; /* Don't post debug messages if debug output is disabled. */
}
}
#endif
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || ((!defined(_MSC_VER) || _MSC_VER >= 1900) && !defined(__STRICT_ANSI__) && !defined(_NO_EXT_KEYS)) #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || ((!defined(_MSC_VER) || _MSC_VER >= 1900) && !defined(__STRICT_ANSI__) && !defined(_NO_EXT_KEYS))
{ {
ma_result result; ma_result result;
...@@ -13064,18 +13054,6 @@ MA_API ma_result ma_log_postf(ma_log* pLog, ma_uint32 level, const char* pFormat ...@@ -13064,18 +13054,6 @@ MA_API ma_result ma_log_postf(ma_log* pLog, ma_uint32 level, const char* pFormat
return MA_INVALID_ARGS; return MA_INVALID_ARGS;
} }
/*
If it's a debug log, ignore it unless MA_DEBUG_OUTPUT is enabled. Do this before generating the
formatted message string so that we don't waste time only to have ma_log_post() reject it.
*/
#if !defined(MA_DEBUG_OUTPUT)
{
if (level == MA_LOG_LEVEL_DEBUG) {
return MA_INVALID_ARGS; /* Don't post debug messages if debug output is disabled. */
}
}
#endif
va_start(args, pFormat); va_start(args, pFormat);
{ {
result = ma_log_postv(pLog, level, pFormat, args); result = ma_log_postv(pLog, level, pFormat, args);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment