0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

modules/console: Toggle DWARNING/DERROR to match DEBUG in release-mode compilations.

This commit is contained in:
Jason Volk 2019-12-03 16:42:14 -08:00
parent 6acc0ba4cb
commit 6b69e240d8

View file

@ -480,27 +480,39 @@ console_cmd__debug(opt &out, const string_view &line)
out << "Turning on debuglog..." << std::endl;
while(!log::console_enabled(log::DEBUG))
log::console_enable(log::DEBUG);
return true;
}
else if(param["onoff"] == "off")
{
out << "Turning off debuglog..." << std::endl;
log::console_disable(log::DEBUG);
return true;
}
else if(log::console_enabled(log::DEBUG))
{
out << "Turning off debuglog..." << std::endl;
log::console_disable(log::DEBUG);
return true;
} else {
out << "Turning on debuglog..." << std::endl;
while(!log::console_enabled(log::DEBUG))
log::console_enable(log::DEBUG);
return true;
}
// When not compiled in debug-mode we attempt to set all DEBUG related
// levels (DERROR / DWARNING) to always match DEBUG. In debug-mode
// compilation they remain independent, but if we don't do this in release
// mode it will leave the user with DERROR messages which weren't DCE'ed
if(!RB_DEBUG_LEVEL)
{
if(log::console_enabled(log::DEBUG))
{
log::console_enable(log::DERROR);
log::console_enable(log::DWARNING);
} else {
log::console_disable(log::DERROR);
log::console_disable(log::DWARNING);
}
}
return true;
}
bool