0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-24 01:18:53 +02: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; out << "Turning on debuglog..." << std::endl;
while(!log::console_enabled(log::DEBUG)) while(!log::console_enabled(log::DEBUG))
log::console_enable(log::DEBUG); log::console_enable(log::DEBUG);
return true;
} }
else if(param["onoff"] == "off") else if(param["onoff"] == "off")
{ {
out << "Turning off debuglog..." << std::endl; out << "Turning off debuglog..." << std::endl;
log::console_disable(log::DEBUG); log::console_disable(log::DEBUG);
return true;
} }
else if(log::console_enabled(log::DEBUG)) else if(log::console_enabled(log::DEBUG))
{ {
out << "Turning off debuglog..." << std::endl; out << "Turning off debuglog..." << std::endl;
log::console_disable(log::DEBUG); log::console_disable(log::DEBUG);
return true;
} else { } else {
out << "Turning on debuglog..." << std::endl; out << "Turning on debuglog..." << std::endl;
while(!log::console_enabled(log::DEBUG)) while(!log::console_enabled(log::DEBUG))
log::console_enable(log::DEBUG); log::console_enable(log::DEBUG);
}
// 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; return true;
}
} }
bool bool