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:
parent
e58545362f
commit
0fdab36710
4 changed files with 26 additions and 2 deletions
|
@ -97,6 +97,7 @@ static const char HELP_STRING[] =
|
|||
" -d, --debuglevel=NUM Set debug verbosity level\n"
|
||||
" --debugflags=FLAGS Enable engine specific debug flags\n"
|
||||
" (separated by commas)\n"
|
||||
" --debug-channels-only Show only the specified debug channels\n"
|
||||
" -u, --dump-scripts Enable script dumping if a directory called 'dumps'\n"
|
||||
" exists in the current directory\n"
|
||||
"\n"
|
||||
|
@ -426,6 +427,9 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
|
|||
DO_LONG_OPTION("debugflags")
|
||||
END_OPTION
|
||||
|
||||
DO_LONG_OPTION_BOOL("debug-channels-only")
|
||||
END_OPTION
|
||||
|
||||
DO_OPTION('e', "music-driver")
|
||||
END_OPTION
|
||||
|
||||
|
|
|
@ -391,6 +391,10 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
|
|||
} else if (ConfMan.hasKey("debugflags"))
|
||||
specialDebug = ConfMan.get("debugflags");
|
||||
|
||||
if (settings.contains("debug-channels-only"))
|
||||
gDebugChannelsOnly = true;
|
||||
|
||||
|
||||
PluginManager::instance().init();
|
||||
PluginManager::instance().loadAllPlugins(); // load plugins for cached plugin manager
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue