diff options
Diffstat (limited to 'common/debug.cpp')
-rw-r--r-- | common/debug.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/common/debug.cpp b/common/debug.cpp index 182b28afdf..c61fc63dea 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -30,6 +30,7 @@ // TODO: Move gDebugLevel into namespace Common. int gDebugLevel = -1; +bool gDebugChannelsOnly = false; namespace Common { @@ -119,6 +120,18 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel) { } // End of namespace Common +bool debugLevelSet(int level) { + return level <= gDebugLevel; +} + +bool debugChannelSet(int level, uint32 debugChannels) { + if (gDebugLevel != 11) + if (level > gDebugLevel || !(DebugMan.isDebugChannelEnabled(debugChannels))) + return false; + + return true; +} + #ifndef DISABLE_TEXT_CONSOLE @@ -137,6 +150,9 @@ static void debugHelper(const char *s, va_list va, bool caret = true) { void debug(const char *s, ...) { va_list va; + if (gDebugChannelsOnly) + return; + va_start(va, s); debugHelper(s, va); va_end(va); @@ -145,7 +161,7 @@ void debug(const char *s, ...) { void debug(int level, const char *s, ...) { va_list va; - if (level > gDebugLevel) + if (level > gDebugLevel || gDebugChannelsOnly) return; va_start(va, s); @@ -157,6 +173,9 @@ void debug(int level, const char *s, ...) { void debugN(const char *s, ...) { va_list va; + if (gDebugChannelsOnly) + return; + va_start(va, s); debugHelper(s, va, false); va_end(va); @@ -165,7 +184,7 @@ void debugN(const char *s, ...) { void debugN(int level, const char *s, ...) { va_list va; - if (level > gDebugLevel) + if (level > gDebugLevel || gDebugChannelsOnly) return; va_start(va, s); |