refs #336 Selectively enabling console output using CLogCategory in swiftcore.

This commit is contained in:
Mathew Sutcliffe
2014-10-14 00:13:12 +01:00
parent d115caf85b
commit 75f72fa5cf

View File

@@ -52,10 +52,12 @@ namespace BlackMiscTest
QString line; QString line;
while (line != "x" && runtime) while (line != "x" && runtime)
{ {
BlackCore::IContextApplication *applicationContext = runtime->getIContextApplication();
BlackCore::IContextNetwork *networkContext = runtime->getIContextNetwork(); BlackCore::IContextNetwork *networkContext = runtime->getIContextNetwork();
BlackCore::IContextAudio *audioContext = runtime->getIContextAudio(); BlackCore::IContextAudio *audioContext = runtime->getIContextAudio();
BlackCore::IContextSettings *settingsContext = runtime->getIContextSettings(); BlackCore::IContextSettings *settingsContext = runtime->getIContextSettings();
BlackCore::IContextOwnAircraft *ownAircraftContext = runtime->getIContextOwnAircraft(); BlackCore::IContextOwnAircraft *ownAircraftContext = runtime->getIContextOwnAircraft();
BlackCore::IContextSimulator *simulatorContext = runtime->getIContextSimulator();
qtout << "-------------" << endl; qtout << "-------------" << endl;
qtout << "Connected with network: " << networkContext->isConnected() << endl; qtout << "Connected with network: " << networkContext->isConnected() << endl;
@@ -167,15 +169,15 @@ namespace BlackMiscTest
else else
{ {
QString category; QString category;
if (line.startsWith("app")) category = IContextApplication::getMessageCategory(); if (line.startsWith("app")) category = CLogCategoryList(applicationContext).back().toQString();
else if (line.startsWith("aud")) category = IContextAudio::getMessageCategory(); else if (line.startsWith("aud")) category = CLogCategoryList(audioContext).back().toQString();
else if (line.startsWith("net")) category = IContextNetwork::getMessageCategory(); else if (line.startsWith("net")) category = CLogCategoryList(networkContext).back().toQString();
else if (line.startsWith("own")) category = IContextOwnAircraft::getMessageCategory(); else if (line.startsWith("own")) category = CLogCategoryList(ownAircraftContext).back().toQString();
else if (line.startsWith("set")) category = IContextSettings::getMessageCategory(); else if (line.startsWith("set")) category = CLogCategoryList(settingsContext).back().toQString();
else if (line.startsWith("sim")) category = IContextSimulator::getMessageCategory(); else if (line.startsWith("sim")) category = CLogCategoryList(simulatorContext).back().toQString();
if (! category.isEmpty()) if (! category.isEmpty())
{ {
BlackMisc::CLogHandler::instance()->handlerForCategory(category)->enableConsoleOutput(enable); BlackMisc::CLogHandler::instance()->handlerForCategoryPrefix(category)->enableConsoleOutput(enable);
} }
} }
} }