diff --git a/interface/resources/qml/ToolWindow.qml b/interface/resources/qml/ToolWindow.qml index f6a4600e06..b4ae882330 100644 --- a/interface/resources/qml/ToolWindow.qml +++ b/interface/resources/qml/ToolWindow.qml @@ -154,7 +154,6 @@ ScrollingWindow { return i; } } - console.warn("Could not find tab for " + source); return -1; } @@ -189,7 +188,6 @@ ScrollingWindow { return i; } } - console.warn("Could not find free tab"); return -1; } @@ -216,7 +214,6 @@ ScrollingWindow { var existingTabIndex = findIndexForUrl(properties.source); if (existingTabIndex >= 0) { - console.log("Existing tab " + existingTabIndex + " found with URL " + properties.source); var tab = tabView.getTab(existingTabIndex); return tab.item; } @@ -239,16 +236,13 @@ ScrollingWindow { var tab = tabView.getTab(freeTabIndex); tab.title = properties.title || "Unknown"; tab.enabled = true; - console.log("New tab URL: " + properties.source) tab.originalUrl = properties.source; var eventBridge = properties.eventBridge; - console.log("Event bridge: " + eventBridge); var result = tab.item; result.enabled = true; tabView.tabCount++; - console.log("Setting event bridge: " + eventBridge); result.eventBridgeWrapper.eventBridge = eventBridge; result.url = properties.source; return result; diff --git a/interface/resources/qml/controls/WebView.qml b/interface/resources/qml/controls/WebView.qml index 2f7a668d65..22c751fb24 100644 --- a/interface/resources/qml/controls/WebView.qml +++ b/interface/resources/qml/controls/WebView.qml @@ -44,7 +44,6 @@ Item { webChannel.registeredObjects: [eventBridgeWrapper] Component.onCompleted: { - console.log("Connecting JS messaging to Hifi Logging"); // Ensure the JS from the web-engine makes it to our logging root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) { console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message); diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ec0a2687ba..ebe7124d46 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -264,7 +264,7 @@ public: auto elapsedMovingAverage = _movingAverage.getAverage(); if (elapsedMovingAverage > _maxElapsedAverage) { - qDebug() << "DEADLOCK WATCHDOG WARNING:" + qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:" << "lastHeartbeatAge:" << lastHeartbeatAge << "elapsedMovingAverage:" << elapsedMovingAverage << "maxElapsed:" << _maxElapsed @@ -274,7 +274,7 @@ public: _maxElapsedAverage = elapsedMovingAverage; } if (lastHeartbeatAge > _maxElapsed) { - qDebug() << "DEADLOCK WATCHDOG WARNING:" + qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:" << "lastHeartbeatAge:" << lastHeartbeatAge << "elapsedMovingAverage:" << elapsedMovingAverage << "PREVIOUS maxElapsed:" << _maxElapsed @@ -284,7 +284,7 @@ public: _maxElapsed = lastHeartbeatAge; } if (elapsedMovingAverage > WARNING_ELAPSED_HEARTBEAT) { - qDebug() << "DEADLOCK WATCHDOG WARNING:" + qCDebug(interfaceapp_deadlock) << "DEADLOCK WATCHDOG WARNING:" << "lastHeartbeatAge:" << lastHeartbeatAge << "elapsedMovingAverage:" << elapsedMovingAverage << "** OVER EXPECTED VALUE **" << "maxElapsed:" << _maxElapsed @@ -293,7 +293,7 @@ public: } if (lastHeartbeatAge > MAX_HEARTBEAT_AGE_USECS) { - qDebug() << "DEADLOCK DETECTED -- " + qCDebug(interfaceapp_deadlock) << "DEADLOCK DETECTED -- " << "lastHeartbeatAge:" << lastHeartbeatAge << "[ lastHeartbeat :" << lastHeartbeat << "now:" << now << " ]" @@ -2005,7 +2005,7 @@ void Application::resizeGL() { static qreal lastDevicePixelRatio = 0; qreal devicePixelRatio = _window->devicePixelRatio(); if (offscreenUi->size() != fromGlm(uiSize) || devicePixelRatio != lastDevicePixelRatio) { - qDebug() << "Device pixel ratio changed, triggering resize to " << uiSize; + qCDebug(interfaceapp) << "Device pixel ratio changed, triggering resize to " << uiSize; offscreenUi->resize(fromGlm(uiSize), true); _offscreenContext->makeCurrent(); lastDevicePixelRatio = devicePixelRatio; @@ -3260,17 +3260,17 @@ void Application::init() { Setting::Handle firstRun { Settings::firstRun, true }; if (addressLookupString.isEmpty() && firstRun.get()) { - qDebug() << "First run and no URL passed... attempting to go to Home or Entry..."; + qCDebug(interfaceapp) << "First run and no URL passed... attempting to go to Home or Entry..."; DependencyManager::get()->ifLocalSandboxRunningElse([](){ - qDebug() << "Home sandbox appears to be running, going to Home."; + qCDebug(interfaceapp) << "Home sandbox appears to be running, going to Home."; DependencyManager::get()->goToLocalSandbox(); }, [](){ - qDebug() << "Home sandbox does not appear to be running, going to Entry."; + qCDebug(interfaceapp) << "Home sandbox does not appear to be running, going to Entry."; DependencyManager::get()->goToEntry(); }); } else { - qDebug() << "Not first run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("previous location") : addressLookupString); + qCDebug(interfaceapp) << "Not first run... going to" << qPrintable(addressLookupString.isEmpty() ? QString("previous location") : addressLookupString); DependencyManager::get()->loadSettings(addressLookupString); } @@ -5617,7 +5617,7 @@ void Application::setActiveDisplayPlugin(const QString& pluginName) { void Application::handleLocalServerConnection() const { auto server = qobject_cast(sender()); - qDebug() << "Got connection on local server from additional instance - waiting for parameters"; + qCDebug(interfaceapp) << "Got connection on local server from additional instance - waiting for parameters"; auto socket = server->nextPendingConnection(); @@ -5633,7 +5633,7 @@ void Application::readArgumentsFromLocalSocket() const { auto message = socket->readAll(); socket->deleteLater(); - qDebug() << "Read from connection: " << message; + qCDebug(interfaceapp) << "Read from connection: " << message; // If we received a message, try to open it as a URL if (message.length() > 0) { @@ -5735,8 +5735,8 @@ void Application::updateThreadPoolCount() const { auto reservedThreads = UI_RESERVED_THREADS + OS_RESERVED_THREADS + _displayPlugin->getRequiredThreadCount(); auto availableThreads = QThread::idealThreadCount() - reservedThreads; auto threadPoolSize = std::max(MIN_PROCESSING_THREAD_POOL_SIZE, availableThreads); - qDebug() << "Ideal Thread Count " << QThread::idealThreadCount(); - qDebug() << "Reserved threads " << reservedThreads; - qDebug() << "Setting thread pool size to " << threadPoolSize; + qCDebug(interfaceapp) << "Ideal Thread Count " << QThread::idealThreadCount(); + qCDebug(interfaceapp) << "Reserved threads " << reservedThreads; + qCDebug(interfaceapp) << "Setting thread pool size to " << threadPoolSize; QThreadPool::globalInstance()->setMaxThreadCount(threadPoolSize); } diff --git a/interface/src/InterfaceLogging.cpp b/interface/src/InterfaceLogging.cpp index 0afcb30c27..49fb0bd640 100644 --- a/interface/src/InterfaceLogging.cpp +++ b/interface/src/InterfaceLogging.cpp @@ -13,3 +13,4 @@ Q_LOGGING_CATEGORY(interfaceapp, "hifi.interface") Q_LOGGING_CATEGORY(interfaceapp_timing, "hifi.interface.timing") +Q_LOGGING_CATEGORY(interfaceapp_deadlock, "hifi.interface.deadlock") diff --git a/interface/src/InterfaceLogging.h b/interface/src/InterfaceLogging.h index be2ee73fba..64eedbda4d 100644 --- a/interface/src/InterfaceLogging.h +++ b/interface/src/InterfaceLogging.h @@ -16,5 +16,6 @@ Q_DECLARE_LOGGING_CATEGORY(interfaceapp) Q_DECLARE_LOGGING_CATEGORY(interfaceapp_timing) +Q_DECLARE_LOGGING_CATEGORY(interfaceapp_deadlock) #endif // hifi_InterfaceLogging_h diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 99922284dc..7d313fdca2 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -182,7 +182,7 @@ AudioClient::~AudioClient() { } void AudioClient::handleMismatchAudioFormat(SharedNodePointer node, const QString& currentCodec, const QString& recievedCodec) { - qDebug() << __FUNCTION__ << "sendingNode:" << *node << "currentCodec:" << currentCodec << "recievedCodec:" << recievedCodec; + qCDebug(audioclient) << __FUNCTION__ << "sendingNode:" << *node << "currentCodec:" << currentCodec << "recievedCodec:" << recievedCodec; selectAudioFormat(recievedCodec); } @@ -632,7 +632,7 @@ void AudioClient::selectAudioFormat(const QString& selectedCodecName) { _selectedCodecName = selectedCodecName; - qDebug() << "Selected Codec:" << _selectedCodecName; + qCDebug(audioclient) << "Selected Codec:" << _selectedCodecName; // release any old codec encoder/decoder first... if (_codec && _encoder) { @@ -648,7 +648,7 @@ void AudioClient::selectAudioFormat(const QString& selectedCodecName) { _codec = plugin; _receivedAudioStream.setupCodec(plugin, _selectedCodecName, AudioConstants::STEREO); _encoder = plugin->createEncoder(AudioConstants::SAMPLE_RATE, AudioConstants::MONO); - qDebug() << "Selected Codec Plugin:" << _codec.get(); + qCDebug(audioclient) << "Selected Codec Plugin:" << _codec.get(); break; } } @@ -997,21 +997,21 @@ void AudioClient::mixLocalAudioInjectors(float* mixBuffer) { } else { - qDebug() << "injector has no more data, marking finished for removal"; + qCDebug(audioclient) << "injector has no more data, marking finished for removal"; injector->finishLocalInjection(); injectorsToRemove.append(injector); } } else { - qDebug() << "injector has no local buffer, marking as finished for removal"; + qCDebug(audioclient) << "injector has no local buffer, marking as finished for removal"; injector->finishLocalInjection(); injectorsToRemove.append(injector); } } for (AudioInjector* injector : injectorsToRemove) { - qDebug() << "removing injector"; + qCDebug(audioclient) << "removing injector"; getActiveLocalAudioInjectors().removeOne(injector); } } @@ -1106,10 +1106,10 @@ bool AudioClient::outputLocalInjector(bool isStereo, AudioInjector* injector) { // Since this is invoked with invokeMethod, there _should_ be // no reason to lock access to the vector of injectors. if (!_activeLocalAudioInjectors.contains(injector)) { - qDebug() << "adding new injector"; + qCDebug(audioclient) << "adding new injector"; _activeLocalAudioInjectors.append(injector); } else { - qDebug() << "injector exists in active list already"; + qCDebug(audioclient) << "injector exists in active list already"; } return true; @@ -1204,7 +1204,7 @@ bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceIn void AudioClient::outputNotify() { int recentUnfulfilled = _audioOutputIODevice.getRecentUnfulfilledReads(); if (recentUnfulfilled > 0) { - qCInfo(audioclient, "Starve detected, %d new unfulfilled reads", recentUnfulfilled); + qCDebug(audioclient, "Starve detected, %d new unfulfilled reads", recentUnfulfilled); if (_outputStarveDetectionEnabled.get()) { quint64 now = usecTimestampNow() / 1000; @@ -1219,7 +1219,8 @@ void AudioClient::outputNotify() { int newOutputBufferSizeFrames = setOutputBufferSize(oldOutputBufferSizeFrames + 1, false); if (newOutputBufferSizeFrames > oldOutputBufferSizeFrames) { - qCInfo(audioclient, "Starve threshold surpassed (%d starves in %d ms)", _outputStarveDetectionCount, dt); + qCDebug(audioclient, + "Starve threshold surpassed (%d starves in %d ms)", _outputStarveDetectionCount, dt); } _outputStarveDetectionStartTimeMsec = now; @@ -1460,10 +1461,10 @@ void AudioClient::loadSettings() { _receivedAudioStream.setWindowSecondsForDesiredReduction(windowSecondsForDesiredReduction.get()); _receivedAudioStream.setRepetitionWithFade(repetitionWithFade.get()); - qDebug() << "---- Initializing Audio Client ----"; + qCDebug(audioclient) << "---- Initializing Audio Client ----"; auto codecPlugins = PluginManager::getInstance()->getCodecPlugins(); for (auto& plugin : codecPlugins) { - qDebug() << "Codec available:" << plugin->getName(); + qCDebug(audioclient) << "Codec available:" << plugin->getName(); } } diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp index ff44d5d13d..fe50f023c3 100755 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -665,7 +665,7 @@ Mapping::Pointer UserInputMapper::newMapping(const QString& mappingName) { if (_mappingsByName.count(mappingName)) { qCWarning(controllers) << "Refusing to recreate mapping named " << mappingName; } - qDebug() << "Creating new Mapping " << mappingName; + qCDebug(controllers) << "Creating new Mapping " << mappingName; auto mapping = std::make_shared(mappingName); _mappingsByName[mappingName] = mapping; return mapping; @@ -1121,15 +1121,15 @@ Mapping::Pointer UserInputMapper::parseMapping(const QString& json) { QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8(), &error); // check validity of the document if (doc.isNull()) { - qDebug() << "Invalid JSON...\n"; - qDebug() << error.errorString(); - qDebug() << "JSON was:\n" << json << endl; + qCDebug(controllers) << "Invalid JSON...\n"; + qCDebug(controllers) << error.errorString(); + qCDebug(controllers) << "JSON was:\n" << json << endl; return Mapping::Pointer(); } if (!doc.isObject()) { qWarning() << "Mapping json Document is not an object" << endl; - qDebug() << "JSON was:\n" << json << endl; + qCDebug(controllers) << "JSON was:\n" << json << endl; return Mapping::Pointer(); } return parseMapping(doc.object()); diff --git a/libraries/fbx/src/FBXReader_Node.cpp b/libraries/fbx/src/FBXReader_Node.cpp index 7bacdbc607..44bb4ac48b 100644 --- a/libraries/fbx/src/FBXReader_Node.cpp +++ b/libraries/fbx/src/FBXReader_Node.cpp @@ -22,6 +22,7 @@ #include #include +#include "ModelFormatLogging.h" template int streamSize() { return sizeof(T); @@ -356,7 +357,7 @@ FBXNode FBXReader::parseFBX(QIODevice* device) { quint32 fileVersion; in >> fileVersion; position += sizeof(fileVersion); - qDebug() << "fileVersion:" << fileVersion; + qCDebug(modelformat) << "fileVersion:" << fileVersion; bool has64BitPositions = (fileVersion >= VERSION_FBX2016); // parse the top-level node diff --git a/libraries/gl/src/gl/Context.cpp b/libraries/gl/src/gl/Context.cpp index 27e1e67560..5b8a1a2fa1 100644 --- a/libraries/gl/src/gl/Context.cpp +++ b/libraries/gl/src/gl/Context.cpp @@ -20,6 +20,8 @@ #include #include +#include "GLLogging.h" + #ifdef Q_OS_WIN @@ -111,7 +113,7 @@ void GLAPIENTRY debugMessageCallback(GLenum source, GLenum type, GLuint id, GLen if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) { return; } - qDebug() << "QQQ " << message; + qCDebug(glLogging) << "QQQ " << message; } // FIXME build the PFD based on the diff --git a/libraries/gl/src/gl/Context.h b/libraries/gl/src/gl/Context.h index 96e6c693fb..6dc859f222 100644 --- a/libraries/gl/src/gl/Context.h +++ b/libraries/gl/src/gl/Context.h @@ -65,7 +65,7 @@ class Context { QWindow* _window { nullptr }; public: virtual ~OffscreenContext(); - virtual void create(); + void create() override; }; } diff --git a/libraries/gl/src/gl/GLLogging.cpp b/libraries/gl/src/gl/GLLogging.cpp new file mode 100644 index 0000000000..18d2023acd --- /dev/null +++ b/libraries/gl/src/gl/GLLogging.cpp @@ -0,0 +1,14 @@ +// +// GLLogging.cpp +// libraries/gl/src/gl/ +// +// Created by Seth Alves on 2016-9-14. +// Copyright 2016 High Fidelity, Inc. +// +// Distribucted under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "GLLogging.h" + +Q_LOGGING_CATEGORY(glLogging, "hifi.glLogging") diff --git a/libraries/gl/src/gl/GLLogging.h b/libraries/gl/src/gl/GLLogging.h new file mode 100644 index 0000000000..1249f4d38e --- /dev/null +++ b/libraries/gl/src/gl/GLLogging.h @@ -0,0 +1,19 @@ +// +// GLLogging.h +// libraries/gl/src/gl/ +// +// Created by Seth Alves on 2016-9-14. +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_GLLogging_h +#define hifi_GLLogging_h + +#include + +Q_DECLARE_LOGGING_CATEGORY(glLogging) + +#endif // hifi_GLLogging_h diff --git a/libraries/gl/src/gl/GLWindow.cpp b/libraries/gl/src/gl/GLWindow.cpp index e553290a04..c40301deb0 100644 --- a/libraries/gl/src/gl/GLWindow.cpp +++ b/libraries/gl/src/gl/GLWindow.cpp @@ -12,6 +12,7 @@ #include #include "GLHelpers.h" +#include "GLLogging.h" void GLWindow::createContext(QOpenGLContext* shareContext) { createContext(getDefaultOpenGLSurfaceFormat(), shareContext); @@ -41,10 +42,10 @@ bool GLWindow::makeCurrent() { Q_ASSERT(makeCurrentResult); std::call_once(_reportOnce, []{ - qDebug() << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); - qDebug() << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); - qDebug() << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR)); - qDebug() << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); + qCDebug(glLogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); + qCDebug(glLogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); + qCDebug(glLogging) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR)); + qCDebug(glLogging) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); }); Q_ASSERT(_context == QOpenGLContext::currentContext()); diff --git a/libraries/gl/src/gl/OffscreenGLCanvas.cpp b/libraries/gl/src/gl/OffscreenGLCanvas.cpp index 3204b50d19..dbd338bc34 100644 --- a/libraries/gl/src/gl/OffscreenGLCanvas.cpp +++ b/libraries/gl/src/gl/OffscreenGLCanvas.cpp @@ -18,6 +18,8 @@ #include #include "GLHelpers.h" +#include "GLLogging.h" + OffscreenGLCanvas::OffscreenGLCanvas() : _context(new QOpenGLContext), _offscreenSurface(new QOffscreenSurface){ } @@ -56,10 +58,10 @@ bool OffscreenGLCanvas::makeCurrent() { Q_ASSERT(result); std::call_once(_reportOnce, [this]{ - qDebug() << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); - qDebug() << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); - qDebug() << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR)); - qDebug() << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); + qCDebug(glLogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); + qCDebug(glLogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); + qCDebug(glLogging) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR)); + qCDebug(glLogging) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); }); return result; diff --git a/libraries/gl/src/gl/OffscreenQmlSurface.cpp b/libraries/gl/src/gl/OffscreenQmlSurface.cpp index 5ab2678474..6a16256198 100644 --- a/libraries/gl/src/gl/OffscreenQmlSurface.cpp +++ b/libraries/gl/src/gl/OffscreenQmlSurface.cpp @@ -32,6 +32,7 @@ #include "OffscreenGLCanvas.h" #include "GLEscrow.h" #include "GLHelpers.h" +#include "GLLogging.h" QString fixupHifiUrl(const QString& urlString) { @@ -196,7 +197,7 @@ QEvent* OffscreenQmlRenderThread::Queue::take() { OffscreenQmlRenderThread::OffscreenQmlRenderThread(OffscreenQmlSurface* surface, QOpenGLContext* shareContext) : _surface(surface) { _canvas.setObjectName("OffscreenQmlRenderCanvas"); - qDebug() << "Building QML Renderer"; + qCDebug(glLogging) << "Building QML Renderer"; if (!_canvas.create(shareContext)) { qWarning("Failed to create OffscreenGLCanvas"); _quit = true; @@ -223,7 +224,7 @@ OffscreenQmlRenderThread::OffscreenQmlRenderThread(OffscreenQmlSurface* surface, } void OffscreenQmlRenderThread::run() { - qDebug() << "Starting QML Renderer thread"; + qCDebug(glLogging) << "Starting QML Renderer thread"; while (!_quit) { QEvent* e = _queue.take(); @@ -282,7 +283,7 @@ QJsonObject OffscreenQmlRenderThread::getGLContextData() { } void OffscreenQmlRenderThread::init() { - qDebug() << "Initializing QML Renderer"; + qCDebug(glLogging) << "Initializing QML Renderer"; if (!_canvas.makeCurrent()) { qWarning("Failed to make context current on QML Renderer Thread"); @@ -341,7 +342,7 @@ void OffscreenQmlRenderThread::resize() { return; } - qDebug() << "Offscreen UI resizing to " << _newSize.width() << "x" << _newSize.height() << " with pixel ratio " << pixelRatio; + qCDebug(glLogging) << "Offscreen UI resizing to " << _newSize.width() << "x" << _newSize.height() << " with pixel ratio " << pixelRatio; _size = newOffscreenSize; } @@ -426,7 +427,7 @@ OffscreenQmlSurface::~OffscreenQmlSurface() { QObject::disconnect(&_updateTimer); QObject::disconnect(qApp); - qDebug() << "Stopping QML Renderer Thread " << _renderer->currentThreadId(); + qCDebug(glLogging) << "Stopping QML Renderer Thread " << _renderer->currentThreadId(); _renderer->_queue.add(STOP); if (!_renderer->wait(MAX_SHUTDOWN_WAIT_SECS * USECS_PER_SECOND)) { qWarning() << "Failed to shut down the QML Renderer Thread"; @@ -443,7 +444,7 @@ void OffscreenQmlSurface::onAboutToQuit() { } void OffscreenQmlSurface::create(QOpenGLContext* shareContext) { - qDebug() << "Building QML surface"; + qCDebug(glLogging) << "Building QML surface"; _renderer = new OffscreenQmlRenderThread(this, shareContext); _renderer->moveToThread(_renderer); diff --git a/libraries/gl/src/gl/OglplusHelpers.cpp b/libraries/gl/src/gl/OglplusHelpers.cpp index d31800dc4c..fc02d75329 100644 --- a/libraries/gl/src/gl/OglplusHelpers.cpp +++ b/libraries/gl/src/gl/OglplusHelpers.cpp @@ -10,6 +10,7 @@ #include #include #include +#include "GLLogging.h" using namespace oglplus; using namespace oglplus::shapes; @@ -190,7 +191,7 @@ public: const int stacks_) { //UV mapping source: http://www.mvps.org/directx/articles/spheremap.htm if (fov >= PI) { - qDebug() << "TexturedHemisphere::buildVBO(): FOV greater or equal than Pi will create issues"; + qCDebug(glLogging) << "TexturedHemisphere::buildVBO(): FOV greater or equal than Pi will create issues"; } int gridSize = std::max(slices_, stacks_); diff --git a/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp index 98a073e283..e3f391126b 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLBackend.cpp @@ -44,10 +44,10 @@ BackendPointer GLBackend::createBackend() { auto version = QOpenGLContextWrapper::currentContextVersion(); std::shared_ptr result; if (!disableOpenGL45 && version >= 0x0405) { - qDebug() << "Using OpenGL 4.5 backend"; + qCDebug(gpugllogging) << "Using OpenGL 4.5 backend"; result = std::make_shared(); } else { - qDebug() << "Using OpenGL 4.1 backend"; + qCDebug(gpugllogging) << "Using OpenGL 4.1 backend"; result = std::make_shared(); } result->initInput(); diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index b4145c73f5..f7f305dcc8 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -765,7 +765,7 @@ void AddressManager::handleShareableNameAPIResponse(QNetworkReply& requestReply) } if (shareableNameChanged) { - qDebug() << "AddressManager shareable name changed to" << _shareablePlaceName; + qCDebug(networking) << "AddressManager shareable name changed to" << _shareablePlaceName; } } } diff --git a/libraries/networking/src/AssetClient.cpp b/libraries/networking/src/AssetClient.cpp index c4ec0ad61e..9583d4735d 100644 --- a/libraries/networking/src/AssetClient.cpp +++ b/libraries/networking/src/AssetClient.cpp @@ -60,7 +60,7 @@ void AssetClient::init() { cache->setMaximumCacheSize(MAXIMUM_CACHE_SIZE); cache->setCacheDirectory(cachePath); networkAccessManager.setCache(cache); - qDebug() << "ResourceManager disk cache setup at" << cachePath + qInfo() << "ResourceManager disk cache setup at" << cachePath << "(size:" << MAXIMUM_CACHE_SIZE / BYTES_PER_GIGABYTES << "GB)"; } } @@ -91,7 +91,7 @@ void AssetClient::clearCache() { } if (auto cache = NetworkAccessManager::getInstance().cache()) { - qDebug() << "AssetClient::clearCache(): Clearing disk cache."; + qInfo() << "AssetClient::clearCache(): Clearing disk cache."; cache->clear(); } else { qCWarning(asset_client) << "No disk cache to clear."; diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 7fad66d608..5aa31efea4 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -351,7 +351,7 @@ qint64 LimitedNodeList::sendPacket(std::unique_ptr packet, const Node& return sendPacket(std::move(packet), *activeSocket, destinationNode.getConnectionSecret()); } else { - qDebug() << "LimitedNodeList::sendPacket called without active socket for node" << destinationNode << "- not sending"; + qCDebug(networking) << "LimitedNodeList::sendPacket called without active socket for node" << destinationNode << "- not sending"; return 0; } } @@ -389,7 +389,7 @@ qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const Node& des emit dataSent(destinationNode.getType(), bytesSent); return bytesSent; } else { - qDebug() << "LimitedNodeList::sendPacketList called without active socket for node" << destinationNode + qCDebug(networking) << "LimitedNodeList::sendPacketList called without active socket for node" << destinationNode << " - not sending."; return 0; } diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index be420604b3..903b160a5e 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -322,7 +322,8 @@ void PhysicalEntitySimulation::addAction(EntityActionPointer action) { QMutexLocker lock(&_mutex); const QUuid& actionID = action->getID(); if (_physicsEngine->getActionByID(actionID)) { - qDebug() << "warning -- PhysicalEntitySimulation::addAction -- adding an action that was already in _physicsEngine"; + qCDebug(physics) << "warning -- PhysicalEntitySimulation::addAction -- adding an " + "action that was already in _physicsEngine"; } } EntitySimulation::addAction(action); diff --git a/libraries/plugins/src/plugins/PluginLogging.cpp b/libraries/plugins/src/plugins/PluginLogging.cpp new file mode 100644 index 0000000000..c6c218acb4 --- /dev/null +++ b/libraries/plugins/src/plugins/PluginLogging.cpp @@ -0,0 +1,14 @@ +// +// PluginLogging.cpp +// libraries/gl/src/gl/ +// +// Created by Seth Alves on 2016-9-14. +// Copyright 2016 High Fidelity, Inc. +// +// Distribucted under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "PluginLogging.h" + +Q_LOGGING_CATEGORY(plugins, "hifi.plugins") diff --git a/libraries/plugins/src/plugins/PluginLogging.h b/libraries/plugins/src/plugins/PluginLogging.h new file mode 100644 index 0000000000..65fd352244 --- /dev/null +++ b/libraries/plugins/src/plugins/PluginLogging.h @@ -0,0 +1,19 @@ +// +// PluginLogging.h +// libraries/gl/src/gl/ +// +// Created by Seth Alves on 2016-9-14. +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_PluginLogging_h +#define hifi_PluginLogging_h + +#include + +Q_DECLARE_LOGGING_CATEGORY(plugins) + +#endif // hifi_PluginLogging_h diff --git a/libraries/plugins/src/plugins/PluginManager.cpp b/libraries/plugins/src/plugins/PluginManager.cpp index 2e60eae678..4baf20c338 100644 --- a/libraries/plugins/src/plugins/PluginManager.cpp +++ b/libraries/plugins/src/plugins/PluginManager.cpp @@ -21,6 +21,7 @@ #include "CodecPlugin.h" #include "DisplayPlugin.h" #include "InputPlugin.h" +#include "PluginLogging.h" PluginManager* PluginManager::getInstance() { @@ -87,10 +88,10 @@ const LoaderList& getLoadedPlugins() { QDir pluginDir(pluginPath); pluginDir.setFilter(QDir::Files); if (pluginDir.exists()) { - qDebug() << "Loading runtime plugins from " << pluginPath; + qInfo() << "Loading runtime plugins from " << pluginPath; auto candidates = pluginDir.entryList(); for (auto plugin : candidates) { - qDebug() << "Attempting plugin" << qPrintable(plugin); + qCDebug(plugins) << "Attempting plugin" << qPrintable(plugin); QSharedPointer loader(new QPluginLoader(pluginPath + plugin)); if (isDisabled(loader->metaData())) { @@ -100,11 +101,11 @@ const LoaderList& getLoadedPlugins() { } if (loader->load()) { - qDebug() << "Plugin" << qPrintable(plugin) << "loaded successfully"; + qCDebug(plugins) << "Plugin" << qPrintable(plugin) << "loaded successfully"; loadedPlugins.push_back(loader); } else { - qDebug() << "Plugin" << qPrintable(plugin) << "failed to load:"; - qDebug() << " " << qPrintable(loader->errorString()); + qCDebug(plugins) << "Plugin" << qPrintable(plugin) << "failed to load:"; + qCDebug(plugins) << " " << qPrintable(loader->errorString()); } } } @@ -139,7 +140,7 @@ const CodecPluginList& PluginManager::getCodecPlugins() { plugin->setContainer(_container); plugin->init(); - qDebug() << "init codec:" << plugin->getName(); + qCDebug(plugins) << "init codec:" << plugin->getName(); } }); return codecPlugins; @@ -157,11 +158,11 @@ static DisplayPluginList displayPlugins; const DisplayPluginList& PluginManager::getDisplayPlugins() { static std::once_flag once; static auto deviceAddedCallback = [](QString deviceName) { - qDebug() << "Added device: " << deviceName; + qCDebug(plugins) << "Added device: " << deviceName; UserActivityLogger::getInstance().connectedDevice("display", deviceName); }; static auto subdeviceAddedCallback = [](QString pluginName, QString deviceName) { - qDebug() << "Added subdevice: " << deviceName; + qCDebug(plugins) << "Added subdevice: " << deviceName; UserActivityLogger::getInstance().connectedDevice("display", pluginName + " | " + deviceName); }; @@ -204,11 +205,11 @@ const InputPluginList& PluginManager::getInputPlugins() { static InputPluginList inputPlugins; static std::once_flag once; static auto deviceAddedCallback = [](QString deviceName) { - qDebug() << "Added device: " << deviceName; + qCDebug(plugins) << "Added device: " << deviceName; UserActivityLogger::getInstance().connectedDevice("input", deviceName); }; static auto subdeviceAddedCallback = [](QString pluginName, QString deviceName) { - qDebug() << "Added subdevice: " << deviceName; + qCDebug(plugins) << "Added subdevice: " << deviceName; UserActivityLogger::getInstance().connectedDevice("input", pluginName + " | " + deviceName); }; diff --git a/libraries/procedural/src/procedural/Procedural.cpp b/libraries/procedural/src/procedural/Procedural.cpp index 1c5ba40891..a995ad5b2f 100644 --- a/libraries/procedural/src/procedural/Procedural.cpp +++ b/libraries/procedural/src/procedural/Procedural.cpp @@ -121,7 +121,9 @@ bool Procedural::parseShader(const QUrl& shaderPath) { if (_shaderUrl.isLocalFile()) { _shaderPath = _shaderUrl.toLocalFile(); +#if WANT_DEBUG qDebug() << "Shader path: " << _shaderPath; +#endif if (!QFile(_shaderPath).exists()) { _networkShader.reset(); return false;; diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index edb6fe437d..bb5d326851 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -767,72 +767,79 @@ void disableQtBearerPoll() { void printSystemInformation() { // Write system information to log - qDebug() << "Build Information"; - qDebug().noquote() << "\tBuild ABI: " << QSysInfo::buildAbi(); - qDebug().noquote() << "\tBuild CPU Architecture: " << QSysInfo::buildCpuArchitecture(); + qCDebug(shared) << "Build Information"; + qCDebug(shared).noquote() << "\tBuild ABI: " << QSysInfo::buildAbi(); + qCDebug(shared).noquote() << "\tBuild CPU Architecture: " << QSysInfo::buildCpuArchitecture(); - qDebug().noquote() << "System Information"; - qDebug().noquote() << "\tProduct Name: " << QSysInfo::prettyProductName(); - qDebug().noquote() << "\tCPU Architecture: " << QSysInfo::currentCpuArchitecture(); - qDebug().noquote() << "\tKernel Type: " << QSysInfo::kernelType(); - qDebug().noquote() << "\tKernel Version: " << QSysInfo::kernelVersion(); + qCDebug(shared).noquote() << "System Information"; + qCDebug(shared).noquote() << "\tProduct Name: " << QSysInfo::prettyProductName(); + qCDebug(shared).noquote() << "\tCPU Architecture: " << QSysInfo::currentCpuArchitecture(); + qCDebug(shared).noquote() << "\tKernel Type: " << QSysInfo::kernelType(); + qCDebug(shared).noquote() << "\tKernel Version: " << QSysInfo::kernelVersion(); auto macVersion = QSysInfo::macVersion(); if (macVersion != QSysInfo::MV_None) { - qDebug() << "\tMac Version: " << macVersion; + qCDebug(shared) << "\tMac Version: " << macVersion; } auto windowsVersion = QSysInfo::windowsVersion(); if (windowsVersion != QSysInfo::WV_None) { - qDebug() << "\tWindows Version: " << windowsVersion; + qCDebug(shared) << "\tWindows Version: " << windowsVersion; } #ifdef Q_OS_WIN SYSTEM_INFO si; GetNativeSystemInfo(&si); - qDebug() << "SYSTEM_INFO"; - qDebug().noquote() << "\tOEM ID: " << si.dwOemId; - qDebug().noquote() << "\tProcessor Architecture: " << si.wProcessorArchitecture; - qDebug().noquote() << "\tProcessor Type: " << si.dwProcessorType; - qDebug().noquote() << "\tProcessor Level: " << si.wProcessorLevel; - qDebug().noquote() << "\tProcessor Revision: " + qCDebug(shared) << "SYSTEM_INFO"; + qCDebug(shared).noquote() << "\tOEM ID: " << si.dwOemId; + qCDebug(shared).noquote() << "\tProcessor Architecture: " << si.wProcessorArchitecture; + qCDebug(shared).noquote() << "\tProcessor Type: " << si.dwProcessorType; + qCDebug(shared).noquote() << "\tProcessor Level: " << si.wProcessorLevel; + qCDebug(shared).noquote() << "\tProcessor Revision: " << QString("0x%1").arg(si.wProcessorRevision, 4, 16, QChar('0')); - qDebug().noquote() << "\tNumber of Processors: " << si.dwNumberOfProcessors; - qDebug().noquote() << "\tPage size: " << si.dwPageSize << " Bytes"; - qDebug().noquote() << "\tMin Application Address: " + qCDebug(shared).noquote() << "\tNumber of Processors: " << si.dwNumberOfProcessors; + qCDebug(shared).noquote() << "\tPage size: " << si.dwPageSize << " Bytes"; + qCDebug(shared).noquote() << "\tMin Application Address: " << QString("0x%1").arg(qulonglong(si.lpMinimumApplicationAddress), 16, 16, QChar('0')); - qDebug().noquote() << "\tMax Application Address: " + qCDebug(shared).noquote() << "\tMax Application Address: " << QString("0x%1").arg(qulonglong(si.lpMaximumApplicationAddress), 16, 16, QChar('0')); const double BYTES_TO_MEGABYTE = 1.0 / (1024 * 1024); - qDebug() << "MEMORYSTATUSEX"; + qCDebug(shared) << "MEMORYSTATUSEX"; MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); if (GlobalMemoryStatusEx(&ms)) { - qDebug().noquote() << QString("\tCurrent System Memory Usage: %1%").arg(ms.dwMemoryLoad); - qDebug().noquote() << QString("\tAvail Physical Memory: %1 MB").arg(ms.ullAvailPhys * BYTES_TO_MEGABYTE, 20, 'f', 2); - qDebug().noquote() << QString("\tTotal Physical Memory: %1 MB").arg(ms.ullTotalPhys * BYTES_TO_MEGABYTE, 20, 'f', 2); - qDebug().noquote() << QString("\tAvail in Page File: %1 MB").arg(ms.ullAvailPageFile * BYTES_TO_MEGABYTE, 20, 'f', 2); - qDebug().noquote() << QString("\tTotal in Page File: %1 MB").arg(ms.ullTotalPageFile * BYTES_TO_MEGABYTE, 20, 'f', 2); - qDebug().noquote() << QString("\tAvail Virtual Memory: %1 MB").arg(ms.ullAvailVirtual * BYTES_TO_MEGABYTE, 20, 'f', 2); - qDebug().noquote() << QString("\tTotal Virtual Memory: %1 MB").arg(ms.ullTotalVirtual * BYTES_TO_MEGABYTE, 20, 'f', 2); + qCDebug(shared).noquote() + << QString("\tCurrent System Memory Usage: %1%").arg(ms.dwMemoryLoad); + qCDebug(shared).noquote() + << QString("\tAvail Physical Memory: %1 MB").arg(ms.ullAvailPhys * BYTES_TO_MEGABYTE, 20, 'f', 2); + qCDebug(shared).noquote() + << QString("\tTotal Physical Memory: %1 MB").arg(ms.ullTotalPhys * BYTES_TO_MEGABYTE, 20, 'f', 2); + qCDebug(shared).noquote() + << QString("\tAvail in Page File: %1 MB").arg(ms.ullAvailPageFile * BYTES_TO_MEGABYTE, 20, 'f', 2); + qCDebug(shared).noquote() + << QString("\tTotal in Page File: %1 MB").arg(ms.ullTotalPageFile * BYTES_TO_MEGABYTE, 20, 'f', 2); + qCDebug(shared).noquote() + << QString("\tAvail Virtual Memory: %1 MB").arg(ms.ullAvailVirtual * BYTES_TO_MEGABYTE, 20, 'f', 2); + qCDebug(shared).noquote() + << QString("\tTotal Virtual Memory: %1 MB").arg(ms.ullTotalVirtual * BYTES_TO_MEGABYTE, 20, 'f', 2); } else { - qDebug() << "\tFailed to retrieve memory status: " << GetLastError(); + qCDebug(shared) << "\tFailed to retrieve memory status: " << GetLastError(); } - qDebug() << "CPUID"; + qCDebug(shared) << "CPUID"; - qDebug() << "\tCPU Vendor: " << CPUIdent::Vendor().c_str(); - qDebug() << "\tCPU Brand: " << CPUIdent::Brand().c_str(); + qCDebug(shared) << "\tCPU Vendor: " << CPUIdent::Vendor().c_str(); + qCDebug(shared) << "\tCPU Brand: " << CPUIdent::Brand().c_str(); for (auto& feature : CPUIdent::getAllFeatures()) { - qDebug().nospace().noquote() << "\t[" << (feature.supported ? "x" : " ") << "] " << feature.name.c_str(); + qCDebug(shared).nospace().noquote() << "\t[" << (feature.supported ? "x" : " ") << "] " << feature.name.c_str(); } #endif - qDebug() << "Environment Variables"; + qCDebug(shared) << "Environment Variables"; // List of env variables to include in the log. For privacy reasons we don't send all env variables. const QStringList envWhitelist = { "QTWEBENGINE_REMOTE_DEBUGGING" @@ -840,7 +847,7 @@ void printSystemInformation() { auto envVariables = QProcessEnvironment::systemEnvironment(); for (auto& env : envWhitelist) { - qDebug().noquote().nospace() << "\t" << + qCDebug(shared).noquote().nospace() << "\t" << (envVariables.contains(env) ? " = " + envVariables.value(env) : " NOT FOUND"); } } @@ -869,4 +876,4 @@ bool getMemoryInfo(MemoryInfo& info) { #endif return false; -} \ No newline at end of file +}