diff options
author | Chris Robinson <[email protected]> | 2020-09-28 00:40:30 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-09-28 00:40:30 -0700 |
commit | da29489ead3ecfc269a220a22ee117d93bed23a6 (patch) | |
tree | 705498f9aaf0d5e71ca9590e477eb21642615e3c | |
parent | 39f4ea61c5978b7abca0ef79de0b207638e7175f (diff) |
Use an enum class for the log level
-rw-r--r-- | alc/alc.cpp | 6 | ||||
-rw-r--r-- | alc/logging.h | 18 |
2 files changed, 12 insertions, 12 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index a870a565..2b9c9ce6 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -976,7 +976,7 @@ void alc_initconfig(void) if(auto loglevel = al::getenv("ALSOFT_LOGLEVEL")) { long lvl = strtol(loglevel->c_str(), nullptr, 0); - if(lvl >= NoLog && lvl <= LogRef) + if(lvl >= static_cast<long>(LogLevel::Disable) && lvl <= static_cast<long>(LogLevel::Ref)) gLogLevel = static_cast<LogLevel>(lvl); } @@ -1272,9 +1272,9 @@ int RTPrioLevel{1}; FILE *gLogFile{stderr}; #ifdef _DEBUG -LogLevel gLogLevel{LogWarning}; +LogLevel gLogLevel{LogLevel::Warning}; #else -LogLevel gLogLevel{LogError}; +LogLevel gLogLevel{LogLevel::Error}; #endif /************************************************ diff --git a/alc/logging.h b/alc/logging.h index 1077f08f..77593779 100644 --- a/alc/logging.h +++ b/alc/logging.h @@ -22,29 +22,29 @@ extern FILE *gLogFile; #define LOG_ANDROID(T, ...) ((void)0) #endif -enum LogLevel { - NoLog, - LogError, - LogWarning, - LogTrace, - LogRef +enum class LogLevel { + Disable, + Error, + Warning, + Trace, + Ref }; extern LogLevel gLogLevel; #define TRACE(...) do { \ - if UNLIKELY(gLogLevel >= LogTrace) \ + if UNLIKELY(gLogLevel >= LogLevel::Trace) \ AL_PRINT(gLogFile, "AL lib: (II) " __VA_ARGS__); \ LOG_ANDROID(ANDROID_LOG_DEBUG, __VA_ARGS__); \ } while(0) #define WARN(...) do { \ - if UNLIKELY(gLogLevel >= LogWarning) \ + if UNLIKELY(gLogLevel >= LogLevel::Warning) \ AL_PRINT(gLogFile, "AL lib: (WW) " __VA_ARGS__); \ LOG_ANDROID(ANDROID_LOG_WARN, __VA_ARGS__); \ } while(0) #define ERR(...) do { \ - if UNLIKELY(gLogLevel >= LogError) \ + if UNLIKELY(gLogLevel >= LogLevel::Error) \ AL_PRINT(gLogFile, "AL lib: (EE) " __VA_ARGS__); \ LOG_ANDROID(ANDROID_LOG_ERROR, __VA_ARGS__); \ } while(0) |