mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
refs #336 Selectively enabling console output using CLogCategory in swiftcore.
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user