Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 20 files). Show all
Unified · Split
| @@ -35,6 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | #include "MenuItemProperties.h" |
| 36 | 36 | #include "ScriptAudioInjector.h" |
| 37 | 37 | #include "ScriptCache.h" |
| 38 | +#include "ScriptEngineLogging.h" | |
| 38 | 39 | #include "ScriptEngine.h" |
| 39 | 40 | #include "TypedArrays.h" |
| 40 | 41 | #include "XMLHttpRequestClass.h" |
| @@ -45,7 +46,7 @@ · 4 unmodified lines | ||
| 45 | 46 | |
| 46 | 47 | |
| 47 | 48 | static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){ |
| 48 | − qDebug() << "script:print()<<" << context->argument(0).toString(); | |
| 49 | + qCDebug(scriptengine) << "script:print()<<" << context->argument(0).toString(); | |
| 49 | 50 | QString message = context->argument(0).toString() |
| 50 | 51 | .replace("\\", "\\\\") |
| 51 | 52 | .replace("\n", "\\n") |
| @@ -271,12 +272,12 @@ void ScriptEngine::loadURL(const QUrl& scriptURL) { · 219 unmodified lines | ||
| 271 | 272 | _fileNameString = url.toLocalFile(); |
| 272 | 273 | QFile scriptFile(_fileNameString); |
| 273 | 274 | if (scriptFile.open(QFile::ReadOnly | QFile::Text)) { |
| 274 | − qDebug() << "ScriptEngine loading file:" << _fileNameString; | |
| 275 | + qCDebug(scriptengine) << "ScriptEngine loading file:" << _fileNameString; | |
| 275 | 276 | QTextStream in(&scriptFile); |
| 276 | 277 | _scriptContents = in.readAll(); |
| 277 | 278 | emit scriptLoaded(_fileNameString); |
| 278 | 279 | } else { |
| 279 | − qDebug() << "ERROR Loading file:" << _fileNameString << "line:" << __LINE__; | |
| 280 | + qCDebug(scriptengine) << "ERROR Loading file:" << _fileNameString << "line:" << __LINE__; | |
| 280 | 281 | emit errorLoadingScript(_fileNameString); |
| 281 | 282 | } |
| 282 | 283 | } else { |
| @@ -294,7 +295,7 @@ void ScriptEngine::scriptContentsAvailable(const QUrl& url, const QString& scrip · 11 unmodified lines | ||
| 294 | 295 | } |
| 295 | 296 | |
| 296 | 297 | void ScriptEngine::errorInLoadingScript(const QUrl& url) { |
| 297 | − qDebug() << "ERROR Loading file:" << url.toString() << "line:" << __LINE__; | |
| 298 | + qCDebug(scriptengine) << "ERROR Loading file:" << url.toString() << "line:" << __LINE__; | |
| 298 | 299 | emit errorLoadingScript(_fileNameString); // ?? |
| 299 | 300 | } |
| 300 | 301 | |
| @@ -402,7 +403,7 @@ void ScriptEngine::evaluate() { · 101 unmodified lines | ||
| 402 | 403 | // will cause this code to never actually run... |
| 403 | 404 | if (hasUncaughtException()) { |
| 404 | 405 | int line = uncaughtExceptionLineNumber(); |
| 405 | − qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString(); | |
| 406 | + qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString(); | |
| 406 | 407 | emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString()); |
| 407 | 408 | clearExceptions(); |
| 408 | 409 | } |
| @@ -417,7 +418,7 @@ QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileN · 8 unmodified lines | ||
| 417 | 418 | QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber); |
| 418 | 419 | if (hasUncaughtException()) { |
| 419 | 420 | int line = uncaughtExceptionLineNumber(); |
| 420 | − qDebug() << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString(); | |
| 421 | + qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString(); | |
| 421 | 422 | } |
| 422 | 423 | _evaluatesPending--; |
| 423 | 424 | emit evaluationFinished(result, hasUncaughtException()); |
| @@ -591,7 +592,7 @@ void ScriptEngine::run() { · 167 unmodified lines | ||
| 591 | 592 | |
| 592 | 593 | if (hasUncaughtException()) { |
| 593 | 594 | int line = uncaughtExceptionLineNumber(); |
| 594 | − qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << uncaughtException().toString(); | |
| 595 | + qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << uncaughtException().toString(); | |
| 595 | 596 | emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + uncaughtException().toString()); |
| 596 | 597 | clearExceptions(); |
| 597 | 598 | } |
| @@ -684,7 +685,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int · 86 unmodified lines | ||
| 684 | 685 | |
| 685 | 686 | QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) { |
| 686 | 687 | if (_stoppingAllScripts) { |
| 687 | − qDebug() << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename(); | |
| 688 | + qCDebug(scriptengine) << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename(); | |
| 688 | 689 | return NULL; // bail early |
| 689 | 690 | } |
| 690 | 691 | |
| @@ -693,7 +694,7 @@ QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) · 2 unmodified lines | ||
| 693 | 694 | |
| 694 | 695 | QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) { |
| 695 | 696 | if (_stoppingAllScripts) { |
| 696 | − qDebug() << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename(); | |
| 697 | + qCDebug(scriptengine) << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename(); | |
| 697 | 698 | return NULL; // bail early |
| 698 | 699 | } |
| 699 | 700 | |
| @@ -743,7 +744,7 @@ void ScriptEngine::print(const QString& message) { · 43 unmodified lines | ||
| 743 | 744 | // all of the files have finished loading. |
| 744 | 745 | void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) { |
| 745 | 746 | if (_stoppingAllScripts) { |
| 746 | − qDebug() << "Script.include() while shutting down is ignored..." | |
| 747 | + qCDebug(scriptengine) << "Script.include() while shutting down is ignored..." | |
| 747 | 748 | << "includeFiles:" << includeFiles << "parent script:" << getFilename(); |
| 748 | 749 | return; // bail early |
| 749 | 750 | } |
| @@ -758,7 +759,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 8 unmodified lines | ||
| 758 | 759 | for (QUrl url : urls) { |
| 759 | 760 | QString contents = data[url]; |
| 760 | 761 | if (contents.isNull()) { |
| 761 | − qDebug() << "Error loading file: " << url << "line:" << __LINE__; | |
| 762 | + qCDebug(scriptengine) << "Error loading file: " << url << "line:" << __LINE__; | |
| 762 | 763 | } else { |
| 763 | 764 | QScriptValue result = evaluate(contents, url.toString()); |
| 764 | 765 | } |
| @@ -787,7 +788,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 22 unmodified lines | ||
| 787 | 788 | |
| 788 | 789 | void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { |
| 789 | 790 | if (_stoppingAllScripts) { |
| 790 | − qDebug() << "Script.include() while shutting down is ignored... " | |
| 791 | + qCDebug(scriptengine) << "Script.include() while shutting down is ignored... " | |
| 791 | 792 | << "includeFile:" << includeFile << "parent script:" << getFilename(); |
| 792 | 793 | return; // bail early |
| 793 | 794 | } |
| @@ -802,7 +803,7 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { · 8 unmodified lines | ||
| 802 | 803 | // the Application or other context will connect to in order to know to actually load the script |
| 803 | 804 | void ScriptEngine::load(const QString& loadFile) { |
| 804 | 805 | if (_stoppingAllScripts) { |
| 805 | − qDebug() << "Script.load() while shutting down is ignored... " | |
| 806 | + qCDebug(scriptengine) << "Script.load() while shutting down is ignored... " | |
| 806 | 807 | << "loadFile:" << loadFile << "parent script:" << getFilename(); |
| 807 | 808 | return; // bail early |
| 808 | 809 | } |