History

put audio and script-engine logging into their own QLoggingCategory

Seth Alves committed 11 years ago

Commit 7af32bd1 parent cb7ff8620 files · +126 −60Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 20 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+14−13
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include "MenuItemProperties.h"
3636 #include "ScriptAudioInjector.h"
3737 #include "ScriptCache.h"
38+#include "ScriptEngineLogging.h"
3839 #include "ScriptEngine.h"
3940 #include "TypedArrays.h"
4041 #include "XMLHttpRequestClass.h"
@@ -45,7 +46,7 @@ · 4 unmodified lines
4546
4647
4748 static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){
48− qDebug() << "script:print()<<" << context->argument(0).toString();
49+ qCDebug(scriptengine) << "script:print()<<" << context->argument(0).toString();
4950 QString message = context->argument(0).toString()
5051 .replace("\\", "\\\\")
5152 .replace("\n", "\\n")
@@ -271,12 +272,12 @@ void ScriptEngine::loadURL(const QUrl& scriptURL) { · 219 unmodified lines
271272 _fileNameString = url.toLocalFile();
272273 QFile scriptFile(_fileNameString);
273274 if (scriptFile.open(QFile::ReadOnly | QFile::Text)) {
274− qDebug() << "ScriptEngine loading file:" << _fileNameString;
275+ qCDebug(scriptengine) << "ScriptEngine loading file:" << _fileNameString;
275276 QTextStream in(&scriptFile);
276277 _scriptContents = in.readAll();
277278 emit scriptLoaded(_fileNameString);
278279 } else {
279− qDebug() << "ERROR Loading file:" << _fileNameString << "line:" << __LINE__;
280+ qCDebug(scriptengine) << "ERROR Loading file:" << _fileNameString << "line:" << __LINE__;
280281 emit errorLoadingScript(_fileNameString);
281282 }
282283 } else {
@@ -294,7 +295,7 @@ void ScriptEngine::scriptContentsAvailable(const QUrl& url, const QString& scrip · 11 unmodified lines
294295 }
295296
296297 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__;
298299 emit errorLoadingScript(_fileNameString); // ??
299300 }
300301
@@ -402,7 +403,7 @@ void ScriptEngine::evaluate() { · 101 unmodified lines
402403 // will cause this code to never actually run...
403404 if (hasUncaughtException()) {
404405 int line = uncaughtExceptionLineNumber();
405− qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();
406+ qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();
406407 emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString());
407408 clearExceptions();
408409 }
@@ -417,7 +418,7 @@ QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileN · 8 unmodified lines
417418 QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber);
418419 if (hasUncaughtException()) {
419420 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();
421422 }
422423 _evaluatesPending--;
423424 emit evaluationFinished(result, hasUncaughtException());
@@ -591,7 +592,7 @@ void ScriptEngine::run() { · 167 unmodified lines
591592
592593 if (hasUncaughtException()) {
593594 int line = uncaughtExceptionLineNumber();
594− qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << uncaughtException().toString();
595+ qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << uncaughtException().toString();
595596 emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + uncaughtException().toString());
596597 clearExceptions();
597598 }
@@ -684,7 +685,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int · 86 unmodified lines
684685
685686 QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) {
686687 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();
688689 return NULL; // bail early
689690 }
690691
@@ -693,7 +694,7 @@ QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) · 2 unmodified lines
693694
694695 QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) {
695696 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();
697698 return NULL; // bail early
698699 }
699700
@@ -743,7 +744,7 @@ void ScriptEngine::print(const QString& message) { · 43 unmodified lines
743744 // all of the files have finished loading.
744745 void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) {
745746 if (_stoppingAllScripts) {
746− qDebug() << "Script.include() while shutting down is ignored..."
747+ qCDebug(scriptengine) << "Script.include() while shutting down is ignored..."
747748 << "includeFiles:" << includeFiles << "parent script:" << getFilename();
748749 return; // bail early
749750 }
@@ -758,7 +759,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 8 unmodified lines
758759 for (QUrl url : urls) {
759760 QString contents = data[url];
760761 if (contents.isNull()) {
761− qDebug() << "Error loading file: " << url << "line:" << __LINE__;
762+ qCDebug(scriptengine) << "Error loading file: " << url << "line:" << __LINE__;
762763 } else {
763764 QScriptValue result = evaluate(contents, url.toString());
764765 }
@@ -787,7 +788,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 22 unmodified lines
787788
788789 void ScriptEngine::include(const QString& includeFile, QScriptValue callback) {
789790 if (_stoppingAllScripts) {
790− qDebug() << "Script.include() while shutting down is ignored... "
791+ qCDebug(scriptengine) << "Script.include() while shutting down is ignored... "
791792 << "includeFile:" << includeFile << "parent script:" << getFilename();
792793 return; // bail early
793794 }
@@ -802,7 +803,7 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { · 8 unmodified lines
802803 // the Application or other context will connect to in order to know to actually load the script
803804 void ScriptEngine::load(const QString& loadFile) {
804805 if (_stoppingAllScripts) {
805− qDebug() << "Script.load() while shutting down is ignored... "
806+ qCDebug(scriptengine) << "Script.load() while shutting down is ignored... "
806807 << "loadFile:" << loadFile << "parent script:" << getFilename();
807808 return; // bail early
808809 }