@@ -1774,7 +1774,7 @@ DEF_CONSOLE_CMD(ConDebugLevel)
|
|||||||
if (argc > 2) return false;
|
if (argc > 2) return false;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
IConsolePrintF(CC_DEFAULT, "Current debug-level: '%s'", GetDebugString());
|
IConsolePrintF(CC_DEFAULT, "Current debug-level: '%s'", GetDebugString().c_str());
|
||||||
} else {
|
} else {
|
||||||
SetDebugString(argv[1], [](const char *err) { IConsolePrint(CC_ERROR, err); });
|
SetDebugString(argv[1], [](const char *err) { IConsolePrint(CC_ERROR, err); });
|
||||||
}
|
}
|
||||||
|
@@ -313,22 +313,13 @@ void SetDebugString(const char *s, void (*error_func)(const char *))
|
|||||||
* Just return a string with the values of all the debug categories.
|
* Just return a string with the values of all the debug categories.
|
||||||
* @return string with debug-levels
|
* @return string with debug-levels
|
||||||
*/
|
*/
|
||||||
const char *GetDebugString()
|
std::string GetDebugString()
|
||||||
{
|
{
|
||||||
const DebugLevel *i;
|
std::string result;
|
||||||
static char dbgstr[150];
|
for (size_t i = 0; i < lengthof(debug_level); i++) {
|
||||||
char dbgval[20];
|
result += stdstr_fmt("%s%s=%d", i == 0 ? "" : ", ", debug_level[i].name, *(debug_level[i].level));
|
||||||
|
|
||||||
memset(dbgstr, 0, sizeof(dbgstr));
|
|
||||||
i = debug_level;
|
|
||||||
seprintf(dbgstr, lastof(dbgstr), "%s=%d", i->name, *i->level);
|
|
||||||
|
|
||||||
for (i++; i != endof(debug_level); i++) {
|
|
||||||
seprintf(dbgval, lastof(dbgval), ", %s=%d", i->name, *i->level);
|
|
||||||
strecat(dbgstr, dbgval, lastof(dbgstr));
|
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
return dbgstr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -69,7 +69,7 @@ void debug_print(const char *dbg, const char *buf);
|
|||||||
|
|
||||||
char *DumpDebugFacilityNames(char *buf, char *last);
|
char *DumpDebugFacilityNames(char *buf, char *last);
|
||||||
void SetDebugString(const char *s, void (*error_func)(const char *));
|
void SetDebugString(const char *s, void (*error_func)(const char *));
|
||||||
const char *GetDebugString();
|
std::string GetDebugString();
|
||||||
|
|
||||||
/* Shorter form for passing filename and linenumber */
|
/* Shorter form for passing filename and linenumber */
|
||||||
#define FILE_LINE __FILE__, __LINE__
|
#define FILE_LINE __FILE__, __LINE__
|
||||||
|
Reference in New Issue
Block a user