- added abstract logger interface
Showing the changes to interface/src/Application.cpp (1 of 13 files). Show all
Unified · Split
| @@ -88,7 +88,7 @@ const float MIRROR_REARVIEW_BODY_DISTANCE = 1.f; · 87 unmodified lines | ||
| 88 | 88 | |
| 89 | 89 | void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { |
| 90 | 90 | fprintf(stdout, "%s", message.toLocal8Bit().constData()); |
| 91 | − LogDisplay::instance.addMessage(message.toLocal8Bit().constData()); | |
| 91 | + Application::getInstance()->getLogger()->addMessage(message.toLocal8Bit().constData()); | |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | Application::Application(int& argc, char** argv, timeval &startup_time) : |
| @@ -149,6 +149,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 54 unmodified lines | ||
| 149 | 149 | QFontDatabase::addApplicationFont("resources/styles/Inconsolata.otf"); |
| 150 | 150 | _window->setWindowTitle("Interface"); |
| 151 | 151 | |
| 152 | + _logger = new FileLogger(); | |
| 153 | + | |
| 152 | 154 | qInstallMessageHandler(messageHandler); |
| 153 | 155 | |
| 154 | 156 | // call Menu getInstance static method to set up the menu |
| @@ -1346,7 +1348,7 @@ void Application::idle() { · 1191 unmodified lines | ||
| 1346 | 1348 | // Normally we check PipelineWarnings, but since idle will often take more than 10ms we only show these idle timing |
| 1347 | 1349 | // details if we're in ExtraDebugging mode. However, the ::update() and it's subcomponents will show their timing |
| 1348 | 1350 | // details normally. |
| 1349 | − bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging); | |
| 1351 | + bool showWarnings = getLogger()->extraDebugging(); | |
| 1350 | 1352 | PerformanceWarning warn(showWarnings, "Application::idle()"); |
| 1351 | 1353 | |
| 1352 | 1354 | timeval check; |
| @@ -2665,7 +2667,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 1312 unmodified lines | ||
| 2665 | 2667 | return; |
| 2666 | 2668 | } |
| 2667 | 2669 | |
| 2668 | − bool wantExtraDebugging = Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging); | |
| 2670 | + bool wantExtraDebugging = getLogger()->extraDebugging(); | |
| 2669 | 2671 | |
| 2670 | 2672 | // These will be the same for all servers, so we can set them up once and then reuse for each server we send to. |
| 2671 | 2673 | _voxelQuery.setWantLowResMoving(!Menu::getInstance()->isOptionChecked(MenuOption::DisableLowRes)); |
| @@ -3349,11 +3351,6 @@ void Application::displayOverlay() { · 677 unmodified lines | ||
| 3349 | 3351 | if (Menu::getInstance()->isOptionChecked(MenuOption::CoverageMap)) { |
| 3350 | 3352 | renderCoverageMap(); |
| 3351 | 3353 | } |
| 3352 | − | |
| 3353 | − | |
| 3354 | − if (Menu::getInstance()->isOptionChecked(MenuOption::Log)) { | |
| 3355 | − LogDisplay::instance.render(_glWidget->width(), _glWidget->height()); | |
| 3356 | − } | |
| 3357 | 3354 | |
| 3358 | 3355 | // Show chat entry field |
| 3359 | 3356 | if (_chatEntryOn) { |
| @@ -4356,7 +4353,7 @@ void* Application::networkReceive(void* args) { · 996 unmodified lines | ||
| 4356 | 4353 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 4357 | 4354 | "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()"); |
| 4358 | 4355 | |
| 4359 | − bool wantExtraDebugging = Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging); | |
| 4356 | + bool wantExtraDebugging = app->getLogger()->extraDebugging(); | |
| 4360 | 4357 | if (wantExtraDebugging && app->_incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) { |
| 4361 | 4358 | int numBytesPacketHeader = numBytesForPacketHeader(app->_incomingPacket); |
| 4362 | 4359 | unsigned char* dataAt = app->_incomingPacket + numBytesPacketHeader; |
| @@ -4481,7 +4478,7 @@ void Application::loadScript() { · 118 unmodified lines | ||
| 4481 | 4478 | |
| 4482 | 4479 | void Application::toggleLogDialog() { |
| 4483 | 4480 | if (! _logDialog) { |
| 4484 | − _logDialog = new LogDialog(_glWidget); | |
| 4481 | + _logDialog = new LogDialog(_glWidget, getLogger()); | |
| 4485 | 4482 | _logDialog->show(); |
| 4486 | 4483 | } else { |
| 4487 | 4484 | _logDialog->close(); |