From ff72f8531cea80be7606e338dbdbd6413b298661 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 10 Jun 2009 10:11:24 +0000 Subject: [PATCH] Added debugCN() call which does not add newline automatically svn-id: r41421 --- common/debug.cpp | 26 ++++++++++++++++++++++++++ common/debug.h | 21 +++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/common/debug.cpp b/common/debug.cpp index cc358596f7b..ff17959cbf7 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -227,6 +227,19 @@ void debugC(int level, uint32 debugChannels, const char *s, ...) { va_end(va); } +void debugCN(int level, uint32 debugChannels, const char *s, ...) { + va_list va; + + // Debug level 11 turns on all special debug level messages + if (gDebugLevel != 11) + if (level > gDebugLevel || !(Common::gDebugLevelsEnabled & debugChannels)) + return; + + va_start(va, s); + debugHelper(s, va, false); + va_end(va); +} + void debugC(uint32 debugChannels, const char *s, ...) { va_list va; @@ -240,4 +253,17 @@ void debugC(uint32 debugChannels, const char *s, ...) { va_end(va); } +void debugCN(uint32 debugChannels, const char *s, ...) { + va_list va; + + // Debug level 11 turns on all special debug level messages + if (gDebugLevel != 11) + if (!(Common::gDebugLevelsEnabled & debugChannels)) + return; + + va_start(va, s); + debugHelper(s, va, false); + va_end(va); +} + #endif diff --git a/common/debug.h b/common/debug.h index 43fe2978596..888c71adbb9 100644 --- a/common/debug.h +++ b/common/debug.h @@ -106,6 +106,8 @@ inline void debug(int level, const char *s, ...) {} inline void debugN(int level, const char *s, ...) {} inline void debugC(int level, uint32 engine_level, const char *s, ...) {} inline void debugC(uint32 engine_level, const char *s, ...) {} +inline void debugCN(int level, uint32 engine_level, const char *s, ...) {} +inline void debugCN(uint32 engine_level, const char *s, ...) {} #else @@ -144,6 +146,17 @@ void debugN(int level, const char *s, ...) GCC_PRINTF(2, 3); */ void debugC(int level, uint32 debugChannels, const char *s, ...) GCC_PRINTF(3, 4); +/** + * Print a debug message to the text console (stdout), but only if + * the specified level does not exceed the value of gDebugLevel OR + * if the specified special debug level is active. + * As a rule of thumb, the more important the message, the lower the level. + * Does not append a newline automatically. + * + * @see enableDebugChannel + */ +void debugCN(int level, uint32 debugChannels, const char *s, ...) GCC_PRINTF(3, 4); + /** * Print a debug message to the text console (stdout), but only if * the specified special debug level is active. @@ -153,6 +166,14 @@ void debugC(int level, uint32 debugChannels, const char *s, ...) GCC_PRINTF(3, 4 */ void debugC(uint32 debugChannels, const char *s, ...) GCC_PRINTF(2, 3); +/** + * Print a debug message to the text console (stdout), but only if + * the specified special debug level is active. + * Does not append a newline automatically. + * + * @see enableDebugChannel + */ +void debugCN(uint32 debugChannels, const char *s, ...) GCC_PRINTF(2, 3); #endif