mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
put audio and script-engine logging into their own QLoggingCategory
This commit is contained in:
parent
cb7ff86386
commit
7af32bd67a
20 changed files with 126 additions and 60 deletions
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "AbstractAudioInterface.h"
|
||||
#include "AudioRingBuffer.h"
|
||||
#include "AudioLogging.h"
|
||||
|
||||
#include "AudioInjector.h"
|
||||
|
||||
|
@ -58,7 +59,7 @@ void AudioInjector::setIsFinished(bool isFinished) {
|
|||
|
||||
if (_shouldDeleteAfterFinish) {
|
||||
// we've been asked to delete after finishing, trigger a queued deleteLater here
|
||||
qDebug() << "AudioInjector triggering delete from setIsFinished";
|
||||
qCDebug(audio) << "AudioInjector triggering delete from setIsFinished";
|
||||
QMetaObject::invokeMethod(this, "deleteLater", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
@ -84,12 +85,12 @@ void AudioInjector::injectAudio() {
|
|||
injectToMixer();
|
||||
}
|
||||
} else {
|
||||
qDebug() << "AudioInjector::injectAudio called but already started.";
|
||||
qCDebug(audio) << "AudioInjector::injectAudio called but already started.";
|
||||
}
|
||||
}
|
||||
|
||||
void AudioInjector::restart() {
|
||||
qDebug() << "Restarting an AudioInjector by stopping and starting over.";
|
||||
qCDebug(audio) << "Restarting an AudioInjector by stopping and starting over.";
|
||||
stop();
|
||||
setIsFinished(false);
|
||||
QMetaObject::invokeMethod(this, "injectAudio", Qt::QueuedConnection);
|
||||
|
@ -114,14 +115,14 @@ void AudioInjector::injectLocally() {
|
|||
connect(_localBuffer, &AudioInjectorLocalBuffer::bufferEmpty, this, &AudioInjector::stop);
|
||||
|
||||
if (!success) {
|
||||
qDebug() << "AudioInjector::injectLocally could not output locally via _localAudioInterface";
|
||||
qCDebug(audio) << "AudioInjector::injectLocally could not output locally via _localAudioInterface";
|
||||
}
|
||||
} else {
|
||||
qDebug() << "AudioInjector::injectLocally called without any data in Sound QByteArray";
|
||||
qCDebug(audio) << "AudioInjector::injectLocally called without any data in Sound QByteArray";
|
||||
}
|
||||
|
||||
} else {
|
||||
qDebug() << "AudioInjector::injectLocally cannot inject locally with no local audio interface present.";
|
||||
qCDebug(audio) << "AudioInjector::injectLocally cannot inject locally with no local audio interface present.";
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
|
|
14
libraries/audio/src/AudioLogging.cpp
Normal file
14
libraries/audio/src/AudioLogging.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// AudioLogging.h
|
||||
// libraries/audio/src
|
||||
//
|
||||
// Created by Seth Alves on 4/6/15.
|
||||
// Copyright 2014 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
|
||||
//
|
||||
|
||||
#include "AudioLogging.h"
|
||||
|
||||
Q_LOGGING_CATEGORY(audio, "hifi.audio")
|
14
libraries/audio/src/AudioLogging.h
Normal file
14
libraries/audio/src/AudioLogging.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// AudioLogging.h
|
||||
// libraries/audio/src
|
||||
//
|
||||
// Created by Seth Alves on 4/6/15.
|
||||
// Copyright 2014 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
|
||||
//
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(audio)
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include <PacketHeaders.h>
|
||||
|
||||
#include "AudioLogging.h"
|
||||
|
||||
#include "AudioRingBuffer.h"
|
||||
|
||||
AudioRingBuffer::AudioRingBuffer(int numFrameSamples, bool randomAccessMode, int numFramesCapacity) :
|
||||
|
@ -126,7 +128,7 @@ int AudioRingBuffer::writeData(const char* data, int maxSize) {
|
|||
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
||||
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
||||
_overflowCount++;
|
||||
qDebug() << "Overflowed ring buffer! Overwriting old data";
|
||||
qCDebug(audio) << "Overflowed ring buffer! Overwriting old data";
|
||||
}
|
||||
|
||||
if (_endOfLastWrite + samplesToCopy <= _buffer + _bufferLength) {
|
||||
|
@ -172,7 +174,7 @@ int AudioRingBuffer::addSilentSamples(int silentSamples) {
|
|||
if (silentSamples > samplesRoomFor) {
|
||||
// there's not enough room for this write. write as many silent samples as we have room for
|
||||
silentSamples = samplesRoomFor;
|
||||
qDebug() << "Dropping some silent samples to prevent ring buffer overflow";
|
||||
qCDebug(audio) << "Dropping some silent samples to prevent ring buffer overflow";
|
||||
}
|
||||
|
||||
// memset zeroes into the buffer, accomodate a wrap around the end
|
||||
|
@ -236,7 +238,7 @@ int AudioRingBuffer::writeSamples(ConstIterator source, int maxSamples) {
|
|||
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
||||
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
||||
_overflowCount++;
|
||||
qDebug() << "Overflowed ring buffer! Overwriting old data";
|
||||
qCDebug(audio) << "Overflowed ring buffer! Overwriting old data";
|
||||
}
|
||||
|
||||
int16_t* bufferLast = _buffer + _bufferLength - 1;
|
||||
|
@ -257,7 +259,7 @@ int AudioRingBuffer::writeSamplesWithFade(ConstIterator source, int maxSamples,
|
|||
int samplesToDelete = samplesToCopy - samplesRoomFor;
|
||||
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, samplesToDelete);
|
||||
_overflowCount++;
|
||||
qDebug() << "Overflowed ring buffer! Overwriting old data";
|
||||
qCDebug(audio) << "Overflowed ring buffer! Overwriting old data";
|
||||
}
|
||||
|
||||
int16_t* bufferLast = _buffer + _bufferLength - 1;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "AudioFormat.h"
|
||||
#include "AudioBuffer.h"
|
||||
#include "AudioEditBuffer.h"
|
||||
#include "AudioLogging.h"
|
||||
#include "Sound.h"
|
||||
|
||||
static int soundMetaTypeId = qRegisterMetaType<Sound*>();
|
||||
|
@ -77,7 +78,7 @@ void Sound::downloadFinished(QNetworkReply* reply) {
|
|||
// since it's raw the only way for us to know that is if the file was called .stereo.raw
|
||||
if (reply->url().fileName().toLower().endsWith("stereo.raw")) {
|
||||
_isStereo = true;
|
||||
qDebug() << "Processing sound of" << rawAudioByteArray.size() << "bytes from" << reply->url() << "as stereo audio file.";
|
||||
qCDebug(audio) << "Processing sound of" << rawAudioByteArray.size() << "bytes from" << reply->url() << "as stereo audio file.";
|
||||
}
|
||||
|
||||
// Process as RAW file
|
||||
|
@ -85,7 +86,7 @@ void Sound::downloadFinished(QNetworkReply* reply) {
|
|||
}
|
||||
trimFrames();
|
||||
} else {
|
||||
qDebug() << "Network reply without 'Content-Type'.";
|
||||
qCDebug(audio) << "Network reply without 'Content-Type'.";
|
||||
}
|
||||
|
||||
_isReady = true;
|
||||
|
@ -216,34 +217,34 @@ void Sound::interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& ou
|
|||
} else {
|
||||
// descriptor.id == "RIFX" also signifies BigEndian file
|
||||
// waveStream.setByteOrder(QDataStream::BigEndian);
|
||||
qDebug() << "Currently not supporting big-endian audio files.";
|
||||
qCDebug(audio) << "Currently not supporting big-endian audio files.";
|
||||
return;
|
||||
}
|
||||
|
||||
if (strncmp(fileHeader.riff.type, "WAVE", 4) != 0
|
||||
|| strncmp(fileHeader.wave.descriptor.id, "fmt", 3) != 0) {
|
||||
qDebug() << "Not a WAVE Audio file.";
|
||||
qCDebug(audio) << "Not a WAVE Audio file.";
|
||||
return;
|
||||
}
|
||||
|
||||
// added the endianess check as an extra level of security
|
||||
|
||||
if (qFromLittleEndian<quint16>(fileHeader.wave.audioFormat) != 1) {
|
||||
qDebug() << "Currently not supporting non PCM audio files.";
|
||||
qCDebug(audio) << "Currently not supporting non PCM audio files.";
|
||||
return;
|
||||
}
|
||||
if (qFromLittleEndian<quint16>(fileHeader.wave.numChannels) == 2) {
|
||||
_isStereo = true;
|
||||
} else if (qFromLittleEndian<quint16>(fileHeader.wave.numChannels) > 2) {
|
||||
qDebug() << "Currently not support audio files with more than 2 channels.";
|
||||
qCDebug(audio) << "Currently not support audio files with more than 2 channels.";
|
||||
}
|
||||
|
||||
if (qFromLittleEndian<quint16>(fileHeader.wave.bitsPerSample) != 16) {
|
||||
qDebug() << "Currently not supporting non 16bit audio files.";
|
||||
qCDebug(audio) << "Currently not supporting non 16bit audio files.";
|
||||
return;
|
||||
}
|
||||
if (qFromLittleEndian<quint32>(fileHeader.wave.sampleRate) != 48000) {
|
||||
qDebug() << "Currently not supporting non 48KHz audio files.";
|
||||
qCDebug(audio) << "Currently not supporting non 48KHz audio files.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -260,7 +261,7 @@ void Sound::interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& ou
|
|||
}
|
||||
waveStream.skipRawData(dataHeader.descriptor.size);
|
||||
} else {
|
||||
qDebug() << "Could not read wav audio data header.";
|
||||
qCDebug(audio) << "Could not read wav audio data header.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -269,11 +270,11 @@ void Sound::interpretAsWav(const QByteArray& inputAudioByteArray, QByteArray& ou
|
|||
quint32 outputAudioByteArraySize = qFromLittleEndian<quint32>(dataHeader.descriptor.size);
|
||||
outputAudioByteArray.resize(outputAudioByteArraySize);
|
||||
if (waveStream.readRawData(outputAudioByteArray.data(), outputAudioByteArraySize) != (int)outputAudioByteArraySize) {
|
||||
qDebug() << "Error reading WAV file";
|
||||
qCDebug(audio) << "Error reading WAV file";
|
||||
}
|
||||
|
||||
} else {
|
||||
qDebug() << "Could not read wav audio file header.";
|
||||
qCDebug(audio) << "Could not read wav audio file header.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <qthread.h>
|
||||
|
||||
#include "AudioLogging.h"
|
||||
#include "SoundCache.h"
|
||||
|
||||
static int soundPointerMetaTypeId = qRegisterMetaType<SharedSoundPointer>();
|
||||
|
@ -34,6 +35,6 @@ SharedSoundPointer SoundCache::getSound(const QUrl& url) {
|
|||
|
||||
QSharedPointer<Resource> SoundCache::createResource(const QUrl& url, const QSharedPointer<Resource>& fallback,
|
||||
bool delayLoad, const void* extra) {
|
||||
qDebug() << "Requesting sound at" << url.toString();
|
||||
qCDebug(audio) << "Requesting sound at" << url.toString();
|
||||
return QSharedPointer<Resource>(new Sound(url), &Resource::allReferencesCleared);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
#include "Shape.h"
|
||||
|
||||
|
||||
QHash<QString, float> COMMENT_SCALE_HINTS;
|
||||
QHash<QString, float> COMMENT_SCALE_HINTS = {{"This file uses centimeters as units", 1.0f / 100.0f},
|
||||
{"This file uses millimeters as units", 1.0f / 1000.0f}};
|
||||
|
||||
|
||||
class OBJTokenizer {
|
||||
|
@ -50,11 +51,6 @@ private:
|
|||
|
||||
|
||||
OBJTokenizer::OBJTokenizer(QIODevice* device) : _device(device), _pushedBackToken(-1) {
|
||||
// This is a list of comments that exports use to hint at scaling
|
||||
if (COMMENT_SCALE_HINTS.isEmpty()) {
|
||||
COMMENT_SCALE_HINTS["This file uses centimeters as units"] = 1.0f / 100.0f;
|
||||
COMMENT_SCALE_HINTS["This file uses millimeters as units"] = 1.0f / 1000.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
|
||||
Q_LOGGING_CATEGORY(networking, "hifi.networking")
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(networking)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
//
|
||||
|
||||
#include "ScriptAudioInjector.h"
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "AudioScriptingInterface.h"
|
||||
|
||||
void registerAudioMetaTypes(QScriptEngine* engine) {
|
||||
|
@ -65,7 +65,7 @@ ScriptAudioInjector* AudioScriptingInterface::playSound(Sound* sound, const Audi
|
|||
return new ScriptAudioInjector(injector);
|
||||
|
||||
} else {
|
||||
qDebug() << "AudioScriptingInterface::playSound called with null Sound object.";
|
||||
qCDebug(scriptengine) << "AudioScriptingInterface::playSound called with null Sound object.";
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,14 @@
|
|||
#include <QNetworkReply>
|
||||
|
||||
#include <QFile>
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "BatchLoader.h"
|
||||
#include <NetworkAccessManager.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
|
||||
|
||||
|
||||
BatchLoader::BatchLoader(const QList<QUrl>& urls)
|
||||
: QObject(),
|
||||
_started(false),
|
||||
|
@ -38,7 +42,7 @@ void BatchLoader::start() {
|
|||
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||
QNetworkReply* reply = networkAccessManager.get(request);
|
||||
|
||||
qDebug() << "Downloading file at" << url;
|
||||
qCDebug(scriptengine) << "Downloading file at" << url;
|
||||
|
||||
connect(reply, &QNetworkReply::finished, [=]() {
|
||||
if (reply->error()) {
|
||||
|
@ -60,7 +64,7 @@ void BatchLoader::start() {
|
|||
QString fileName = url.toLocalFile();
|
||||
#endif
|
||||
|
||||
qDebug() << "Reading file at " << fileName;
|
||||
qCDebug(scriptengine) << "Reading file at " << fileName;
|
||||
|
||||
QFile scriptFile(fileName);
|
||||
if (scriptFile.open(QFile::ReadOnly | QFile::Text)) {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include <qdebug.h>
|
||||
#include <qscriptengine.h>
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
|
||||
#include "KeyEvent.h"
|
||||
|
||||
KeyEvent::KeyEvent() :
|
||||
|
@ -276,7 +278,7 @@ void KeyEvent::fromScriptValue(const QScriptValue& object, KeyEvent& event) {
|
|||
|
||||
const bool wantDebug = false;
|
||||
if (wantDebug) {
|
||||
qDebug() << "event.key=" << event.key
|
||||
qCDebug(scriptengine) << "event.key=" << event.key
|
||||
<< " event.text=" << event.text
|
||||
<< " event.isShifted=" << event.isShifted
|
||||
<< " event.isControl=" << event.isControl
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <OctreeConstants.h>
|
||||
#include <GLMHelpers.h>
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "Quat.h"
|
||||
|
||||
|
||||
|
@ -81,7 +82,7 @@ float Quat::dot(const glm::quat& q1, const glm::quat& q2) {
|
|||
}
|
||||
|
||||
void Quat::print(const QString& lable, const glm::quat& q) {
|
||||
qDebug() << qPrintable(lable) << q.x << "," << q.y << "," << q.z << "," << q.w;
|
||||
qCDebug(scriptengine) << qPrintable(lable) << q.x << "," << q.y << "," << q.z << "," << q.w;
|
||||
}
|
||||
|
||||
bool Quat::equal(const glm::vec3& q1, const glm::vec3& q2) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "ScriptAudioInjector.h"
|
||||
|
||||
QScriptValue injectorToScriptValue(QScriptEngine* engine, ScriptAudioInjector* const& in) {
|
||||
|
@ -38,6 +39,6 @@ ScriptAudioInjector::~ScriptAudioInjector() {
|
|||
}
|
||||
|
||||
void ScriptAudioInjector::stopInjectorImmediately() {
|
||||
qDebug() << "ScriptAudioInjector::stopInjectorImmediately called to stop audio injector immediately.";
|
||||
qCDebug(scriptengine) << "ScriptAudioInjector::stopInjectorImmediately called to stop audio injector immediately.";
|
||||
_injector->stopAndDeleteLater();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <NetworkAccessManager.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "ScriptCache.h"
|
||||
|
||||
ScriptCache::ScriptCache(QObject* parent) {
|
||||
|
@ -27,7 +27,7 @@ ScriptCache::ScriptCache(QObject* parent) {
|
|||
QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& isPending) {
|
||||
QString scriptContents;
|
||||
if (_scriptCache.contains(url)) {
|
||||
qDebug() << "Found script in cache:" << url.toString();
|
||||
qCDebug(scriptengine) << "Found script in cache:" << url.toString();
|
||||
scriptContents = _scriptCache[url];
|
||||
scriptUser->scriptContentsAvailable(url, scriptContents);
|
||||
isPending = false;
|
||||
|
@ -37,13 +37,13 @@ QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& is
|
|||
_scriptUsers.insert(url, scriptUser);
|
||||
|
||||
if (alreadyWaiting) {
|
||||
qDebug() << "Already downloading script at:" << url.toString();
|
||||
qCDebug(scriptengine) << "Already downloading script at:" << url.toString();
|
||||
} else {
|
||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||
QNetworkRequest networkRequest = QNetworkRequest(url);
|
||||
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||
|
||||
qDebug() << "Downloading script at:" << url.toString();
|
||||
qCDebug(scriptengine) << "Downloading script at:" << url.toString();
|
||||
QNetworkReply* reply = networkAccessManager.get(networkRequest);
|
||||
connect(reply, &QNetworkReply::finished, this, &ScriptCache::scriptDownloaded);
|
||||
}
|
||||
|
@ -59,13 +59,13 @@ void ScriptCache::scriptDownloaded() {
|
|||
|
||||
if (reply->error() == QNetworkReply::NoError && reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 200) {
|
||||
_scriptCache[url] = reply->readAll();
|
||||
qDebug() << "Done downloading script at:" << url.toString();
|
||||
qCDebug(scriptengine) << "Done downloading script at:" << url.toString();
|
||||
|
||||
foreach(ScriptUser* user, scriptUsers) {
|
||||
user->scriptContentsAvailable(url, _scriptCache[url]);
|
||||
}
|
||||
} else {
|
||||
qDebug() << "ERROR Loading file:" << reply->url().toString();
|
||||
qCDebug(scriptengine) << "ERROR Loading file:" << reply->url().toString();
|
||||
foreach(ScriptUser* user, scriptUsers) {
|
||||
user->errorInLoadingScript(url);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "MenuItemProperties.h"
|
||||
#include "ScriptAudioInjector.h"
|
||||
#include "ScriptCache.h"
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "ScriptEngine.h"
|
||||
#include "TypedArrays.h"
|
||||
#include "XMLHttpRequestClass.h"
|
||||
|
@ -45,7 +46,7 @@
|
|||
|
||||
|
||||
static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){
|
||||
qDebug() << "script:print()<<" << context->argument(0).toString();
|
||||
qCDebug(scriptengine) << "script:print()<<" << context->argument(0).toString();
|
||||
QString message = context->argument(0).toString()
|
||||
.replace("\\", "\\\\")
|
||||
.replace("\n", "\\n")
|
||||
|
@ -271,12 +272,12 @@ void ScriptEngine::loadURL(const QUrl& scriptURL) {
|
|||
_fileNameString = url.toLocalFile();
|
||||
QFile scriptFile(_fileNameString);
|
||||
if (scriptFile.open(QFile::ReadOnly | QFile::Text)) {
|
||||
qDebug() << "ScriptEngine loading file:" << _fileNameString;
|
||||
qCDebug(scriptengine) << "ScriptEngine loading file:" << _fileNameString;
|
||||
QTextStream in(&scriptFile);
|
||||
_scriptContents = in.readAll();
|
||||
emit scriptLoaded(_fileNameString);
|
||||
} else {
|
||||
qDebug() << "ERROR Loading file:" << _fileNameString << "line:" << __LINE__;
|
||||
qCDebug(scriptengine) << "ERROR Loading file:" << _fileNameString << "line:" << __LINE__;
|
||||
emit errorLoadingScript(_fileNameString);
|
||||
}
|
||||
} else {
|
||||
|
@ -294,7 +295,7 @@ void ScriptEngine::scriptContentsAvailable(const QUrl& url, const QString& scrip
|
|||
}
|
||||
|
||||
void ScriptEngine::errorInLoadingScript(const QUrl& url) {
|
||||
qDebug() << "ERROR Loading file:" << url.toString() << "line:" << __LINE__;
|
||||
qCDebug(scriptengine) << "ERROR Loading file:" << url.toString() << "line:" << __LINE__;
|
||||
emit errorLoadingScript(_fileNameString); // ??
|
||||
}
|
||||
|
||||
|
@ -402,7 +403,7 @@ void ScriptEngine::evaluate() {
|
|||
// will cause this code to never actually run...
|
||||
if (hasUncaughtException()) {
|
||||
int line = uncaughtExceptionLineNumber();
|
||||
qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();
|
||||
qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << result.toString();
|
||||
emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + result.toString());
|
||||
clearExceptions();
|
||||
}
|
||||
|
@ -417,7 +418,7 @@ QScriptValue ScriptEngine::evaluate(const QString& program, const QString& fileN
|
|||
QScriptValue result = QScriptEngine::evaluate(program, fileName, lineNumber);
|
||||
if (hasUncaughtException()) {
|
||||
int line = uncaughtExceptionLineNumber();
|
||||
qDebug() << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString();
|
||||
qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << " : " << fileName << ") line" << line << ": " << result.toString();
|
||||
}
|
||||
_evaluatesPending--;
|
||||
emit evaluationFinished(result, hasUncaughtException());
|
||||
|
@ -591,7 +592,7 @@ void ScriptEngine::run() {
|
|||
|
||||
if (hasUncaughtException()) {
|
||||
int line = uncaughtExceptionLineNumber();
|
||||
qDebug() << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << uncaughtException().toString();
|
||||
qCDebug(scriptengine) << "Uncaught exception at (" << _fileNameString << ") line" << line << ":" << uncaughtException().toString();
|
||||
emit errorMessage("Uncaught exception at (" + _fileNameString + ") line" + QString::number(line) + ":" + uncaughtException().toString());
|
||||
clearExceptions();
|
||||
}
|
||||
|
@ -684,7 +685,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int
|
|||
|
||||
QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) {
|
||||
if (_stoppingAllScripts) {
|
||||
qDebug() << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename();
|
||||
qCDebug(scriptengine) << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename();
|
||||
return NULL; // bail early
|
||||
}
|
||||
|
||||
|
@ -693,7 +694,7 @@ QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS)
|
|||
|
||||
QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) {
|
||||
if (_stoppingAllScripts) {
|
||||
qDebug() << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename();
|
||||
qCDebug(scriptengine) << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename();
|
||||
return NULL; // bail early
|
||||
}
|
||||
|
||||
|
@ -743,7 +744,7 @@ void ScriptEngine::print(const QString& message) {
|
|||
// all of the files have finished loading.
|
||||
void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) {
|
||||
if (_stoppingAllScripts) {
|
||||
qDebug() << "Script.include() while shutting down is ignored..."
|
||||
qCDebug(scriptengine) << "Script.include() while shutting down is ignored..."
|
||||
<< "includeFiles:" << includeFiles << "parent script:" << getFilename();
|
||||
return; // bail early
|
||||
}
|
||||
|
@ -758,7 +759,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac
|
|||
for (QUrl url : urls) {
|
||||
QString contents = data[url];
|
||||
if (contents.isNull()) {
|
||||
qDebug() << "Error loading file: " << url << "line:" << __LINE__;
|
||||
qCDebug(scriptengine) << "Error loading file: " << url << "line:" << __LINE__;
|
||||
} else {
|
||||
QScriptValue result = evaluate(contents, url.toString());
|
||||
}
|
||||
|
@ -787,7 +788,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac
|
|||
|
||||
void ScriptEngine::include(const QString& includeFile, QScriptValue callback) {
|
||||
if (_stoppingAllScripts) {
|
||||
qDebug() << "Script.include() while shutting down is ignored... "
|
||||
qCDebug(scriptengine) << "Script.include() while shutting down is ignored... "
|
||||
<< "includeFile:" << includeFile << "parent script:" << getFilename();
|
||||
return; // bail early
|
||||
}
|
||||
|
@ -802,7 +803,7 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) {
|
|||
// the Application or other context will connect to in order to know to actually load the script
|
||||
void ScriptEngine::load(const QString& loadFile) {
|
||||
if (_stoppingAllScripts) {
|
||||
qDebug() << "Script.load() while shutting down is ignored... "
|
||||
qCDebug(scriptengine) << "Script.load() while shutting down is ignored... "
|
||||
<< "loadFile:" << loadFile << "parent script:" << getFilename();
|
||||
return; // bail early
|
||||
}
|
||||
|
|
14
libraries/script-engine/src/ScriptEngineLogging.cpp
Normal file
14
libraries/script-engine/src/ScriptEngineLogging.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// ScriptEngineLogging.h
|
||||
// libraries/script-engine/src
|
||||
//
|
||||
// Created by Seth Alves on 4/6/15.
|
||||
// Copyright 2014 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
|
||||
//
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
|
||||
Q_LOGGING_CATEGORY(scriptengine, "hifi.scriptengine")
|
14
libraries/script-engine/src/ScriptEngineLogging.h
Normal file
14
libraries/script-engine/src/ScriptEngineLogging.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// ScriptEngineLogging.h
|
||||
// libraries/script-engine/src
|
||||
//
|
||||
// Created by Seth Alves on 4/6/15.
|
||||
// Copyright 2014 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
|
||||
//
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(scriptengine)
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "ScriptUUID.h"
|
||||
|
||||
QUuid ScriptUUID::fromString(const QString& s) {
|
||||
|
@ -36,5 +37,5 @@ bool ScriptUUID::isNull(const QUuid& id) {
|
|||
}
|
||||
|
||||
void ScriptUUID::print(const QString& lable, const QUuid& id) {
|
||||
qDebug() << qPrintable(lable) << id.toString();
|
||||
qCDebug(scriptengine) << qPrintable(lable) << id.toString();
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "Vec3.h"
|
||||
|
||||
glm::vec3 Vec3::reflect(const glm::vec3& v1, const glm::vec3& v2) {
|
||||
|
@ -66,7 +67,7 @@ glm::vec3 Vec3::mix(const glm::vec3& v1, const glm::vec3& v2, float m) {
|
|||
}
|
||||
|
||||
void Vec3::print(const QString& lable, const glm::vec3& v) {
|
||||
qDebug() << qPrintable(lable) << v.x << "," << v.y << "," << v.z;
|
||||
qCDebug(scriptengine) << qPrintable(lable) << v.x << "," << v.y << "," << v.z;
|
||||
}
|
||||
|
||||
bool Vec3::equal(const glm::vec3& v1, const glm::vec3& v2) {
|
||||
|
|
Loading…
Reference in a new issue