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.
This commit is contained in:
Eugene Sandulenko 2016-08-13 21:04:42 +02:00
parent e58545362f
commit 0fdab36710
4 changed files with 26 additions and 2 deletions

View file

@ -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);