aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEugene Sandulenko2016-08-13 21:04:42 +0200
committerEugene Sandulenko2016-08-13 21:07:43 +0200
commit0fdab36710a3d74839c09bbaf48cbc502b898ebd (patch)
tree213f1ebcdcc574c65e2cba08d0e216fa60035877 /common
parente58545362f7829ade95f7bdb5e323c3e203c9bec (diff)
downloadscummvm-rg350-0fdab36710a3d74839c09bbaf48cbc502b898ebd.tar.gz
scummvm-rg350-0fdab36710a3d74839c09bbaf48cbc502b898ebd.tar.bz2
scummvm-rg350-0fdab36710a3d74839c09bbaf48cbc502b898ebd.zip
COMMON: Introduce --debug-channels-only command line flag.
Many of our systems currently generate significant amount of debug output on deeper levels. Now, when your engine is using Debug Channels, you might want to show that debug information only, which is currently not possible, as the generic output will be mixed in your output. Alternative solution would be to implement possibility to specify per-channel debug levels.
Diffstat (limited to 'common')
-rw-r--r--common/debug.cpp11
-rw-r--r--common/debug.h9
2 files changed, 18 insertions, 2 deletions
diff --git a/common/debug.cpp b/common/debug.cpp
index 182b28afdf..ce34a00445 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 {
@@ -137,6 +138,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 +149,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 +161,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 +172,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);
diff --git a/common/debug.h b/common/debug.h
index b6e0679a12..00bad81fa6 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -118,6 +118,15 @@ void debugCN(uint32 debugChannels, const char *s, ...) GCC_PRINTF(2, 3);
*/
extern int gDebugLevel;
+/**
+ * Specify if we want to show only the debug channels and suppress
+ * the non-channeled output.
+ *
+ * This option is useful when you want to have higher levels of channels
+ * visible without the noise from other subsystems or OSystem.
+ */
+extern bool gDebugChannelsOnly;
+
//Global constant for EventRecorder debug channel
enum GlobalDebugLevels {
kDebugLevelEventRec = 1 << 30