mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 09:17:29 +02:00
Adding logger calls
This commit is contained in:
parent
e9dffc0681
commit
f33ad8a100
6 changed files with 56 additions and 34 deletions
|
@ -60,6 +60,7 @@
|
||||||
#include <ParticlesScriptingInterface.h>
|
#include <ParticlesScriptingInterface.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <ResourceCache.h>
|
#include <ResourceCache.h>
|
||||||
|
#include <UserActivityLogger.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
#include <OctreeSceneStats.h>
|
#include <OctreeSceneStats.h>
|
||||||
#include <LocalVoxelsList.h>
|
#include <LocalVoxelsList.h>
|
||||||
|
@ -268,6 +269,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
// set the account manager's root URL and trigger a login request if we don't have the access token
|
// set the account manager's root URL and trigger a login request if we don't have the access token
|
||||||
accountManager.setAuthURL(DEFAULT_NODE_AUTH_URL);
|
accountManager.setAuthURL(DEFAULT_NODE_AUTH_URL);
|
||||||
|
UserActivityLogger::getInstance().launch();
|
||||||
|
|
||||||
// once the event loop has started, check and signal for an access token
|
// once the event loop has started, check and signal for an access token
|
||||||
QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection);
|
||||||
|
@ -396,7 +398,19 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
int DELAI_TIME = 1000;
|
||||||
|
QEventLoop loop;
|
||||||
|
QTimer timer;
|
||||||
|
connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
|
||||||
|
JSONCallbackParameters params;
|
||||||
|
params.jsonCallbackReceiver = &loop;
|
||||||
|
params.errorCallbackReceiver = &loop;
|
||||||
|
params.jsonCallbackMethod = "quit";
|
||||||
|
params.errorCallbackMethod = "quit";
|
||||||
|
UserActivityLogger::getInstance().close(params);
|
||||||
|
timer.start(DELAI_TIME);
|
||||||
|
loop.exec();
|
||||||
|
|
||||||
qInstallMessageHandler(NULL);
|
qInstallMessageHandler(NULL);
|
||||||
|
|
||||||
// make sure we don't call the idle timer any more
|
// make sure we don't call the idle timer any more
|
||||||
|
@ -3558,6 +3572,7 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript
|
||||||
|
|
||||||
_scriptEnginesHash.insertMulti(scriptURLString, scriptEngine);
|
_scriptEnginesHash.insertMulti(scriptURLString, scriptEngine);
|
||||||
_runningScriptsWidget->setRunningScripts(getRunningScripts());
|
_runningScriptsWidget->setRunningScripts(getRunningScripts());
|
||||||
|
UserActivityLogger::getInstance().loadedScript(scriptURLString);
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so
|
// setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "SixenseManager.h"
|
#include "SixenseManager.h"
|
||||||
|
#include "UserActivityLogger.h"
|
||||||
|
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE
|
||||||
const int CALIBRATION_STATE_IDLE = 0;
|
const int CALIBRATION_STATE_IDLE = 0;
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "PreferencesDialog.h"
|
|
||||||
#include "ModelsBrowser.h"
|
#include "ModelsBrowser.h"
|
||||||
|
#include "PreferencesDialog.h"
|
||||||
|
#include "UserActivityLogger.h"
|
||||||
|
|
||||||
const int SCROLL_PANEL_BOTTOM_MARGIN = 30;
|
const int SCROLL_PANEL_BOTTOM_MARGIN = 30;
|
||||||
const int OK_BUTTON_RIGHT_MARGIN = 30;
|
const int OK_BUTTON_RIGHT_MARGIN = 30;
|
||||||
|
@ -176,6 +177,7 @@ void PreferencesDialog::savePreferences() {
|
||||||
QString displayNameStr(ui.displayNameEdit->text());
|
QString displayNameStr(ui.displayNameEdit->text());
|
||||||
if (displayNameStr != _displayNameString) {
|
if (displayNameStr != _displayNameString) {
|
||||||
myAvatar->setDisplayName(displayNameStr);
|
myAvatar->setDisplayName(displayNameStr);
|
||||||
|
UserActivityLogger::getInstance().changedDisplayName(displayNameStr);
|
||||||
shouldDispatchIdentityPacket = true;
|
shouldDispatchIdentityPacket = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +185,7 @@ void PreferencesDialog::savePreferences() {
|
||||||
if (faceModelURL.toString() != _faceURLString) {
|
if (faceModelURL.toString() != _faceURLString) {
|
||||||
// change the faceModelURL in the profile, it will also update this user's BlendFace
|
// change the faceModelURL in the profile, it will also update this user's BlendFace
|
||||||
myAvatar->setFaceModelURL(faceModelURL);
|
myAvatar->setFaceModelURL(faceModelURL);
|
||||||
|
UserActivityLogger::getInstance().changedModel("head", faceModelURL.toString());
|
||||||
shouldDispatchIdentityPacket = true;
|
shouldDispatchIdentityPacket = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,6 +193,7 @@ void PreferencesDialog::savePreferences() {
|
||||||
if (skeletonModelURL.toString() != _skeletonURLString) {
|
if (skeletonModelURL.toString() != _skeletonURLString) {
|
||||||
// change the skeletonModelURL in the profile, it will also update this user's Body
|
// change the skeletonModelURL in the profile, it will also update this user's Body
|
||||||
myAvatar->setSkeletonModelURL(skeletonModelURL);
|
myAvatar->setSkeletonModelURL(skeletonModelURL);
|
||||||
|
UserActivityLogger::getInstance().changedModel("skeleton", skeletonModelURL.toString());
|
||||||
shouldDispatchIdentityPacket = true;
|
shouldDispatchIdentityPacket = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "NodeList.h"
|
#include "NodeList.h"
|
||||||
#include "PacketHeaders.h"
|
#include "PacketHeaders.h"
|
||||||
|
#include "UserActivityLogger.h"
|
||||||
|
|
||||||
#include "DomainHandler.h"
|
#include "DomainHandler.h"
|
||||||
|
|
||||||
|
@ -83,6 +84,7 @@ void DomainHandler::setHostname(const QString& hostname) {
|
||||||
qDebug("Looking up DS hostname %s.", _hostname.toLocal8Bit().constData());
|
qDebug("Looking up DS hostname %s.", _hostname.toLocal8Bit().constData());
|
||||||
QHostInfo::lookupHost(_hostname, this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
QHostInfo::lookupHost(_hostname, this, SLOT(completedHostnameLookup(const QHostInfo&)));
|
||||||
|
|
||||||
|
UserActivityLogger::getInstance().changedDomain(_hostname);
|
||||||
emit hostnameChanged(_hostname);
|
emit hostnameChanged(_hostname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
#include "UserActivityLogger.h"
|
#include "UserActivityLogger.h"
|
||||||
|
|
||||||
#include "AccountManager.h"
|
|
||||||
|
|
||||||
#include <QHttpMultiPart>
|
#include <QHttpMultiPart>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
|
||||||
|
@ -26,32 +24,32 @@ UserActivityLogger& UserActivityLogger::getInstance() {
|
||||||
UserActivityLogger::UserActivityLogger() {
|
UserActivityLogger::UserActivityLogger() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserActivityLogger::logAction(QString action, QJsonObject details) {
|
void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCallbackParameters params) {
|
||||||
AccountManager& accountManager = AccountManager::getInstance();
|
AccountManager& accountManager = AccountManager::getInstance();
|
||||||
QHttpMultiPart* multipart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
|
QHttpMultiPart* multipart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
|
||||||
|
|
||||||
if (action != "login") {
|
QHttpPart actionPart;
|
||||||
QHttpPart actionPart;
|
actionPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"action_name\"");
|
||||||
actionPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"action_name\"");
|
actionPart.setBody(QByteArray().append(action));
|
||||||
actionPart.setBody(QByteArray().append(action));
|
multipart->append(actionPart);
|
||||||
multipart->append(actionPart);
|
|
||||||
|
|
||||||
|
|
||||||
if (!details.isEmpty()) {
|
|
||||||
QHttpPart detailsPart;
|
|
||||||
detailsPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data;"
|
|
||||||
" name=\"action_details\"");
|
|
||||||
detailsPart.setBody(QJsonDocument(details).toJson(QJsonDocument::Compact));
|
|
||||||
multipart->append(detailsPart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
qDebug() << "Loging activity " << action;
|
|
||||||
|
|
||||||
JSONCallbackParameters params;
|
|
||||||
params.jsonCallbackReceiver = this;
|
if (!details.isEmpty()) {
|
||||||
params.jsonCallbackMethod = "requestFinished";
|
QHttpPart detailsPart;
|
||||||
params.errorCallbackReceiver = this;
|
detailsPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data;"
|
||||||
params.errorCallbackMethod = "requestError";
|
" name=\"action_details\"");
|
||||||
|
detailsPart.setBody(QJsonDocument(details).toJson(QJsonDocument::Compact));
|
||||||
|
multipart->append(detailsPart);
|
||||||
|
}
|
||||||
|
qDebug() << "Loging activity" << action;
|
||||||
|
qDebug() << AccountManager::getInstance().getAuthURL() << ": " << AccountManager::getInstance().isLoggedIn();
|
||||||
|
|
||||||
|
if (params.isEmpty()) {
|
||||||
|
params.jsonCallbackReceiver = this;
|
||||||
|
params.jsonCallbackMethod = "requestFinished";
|
||||||
|
params.errorCallbackReceiver = this;
|
||||||
|
params.errorCallbackMethod = "requestError";
|
||||||
|
}
|
||||||
|
|
||||||
accountManager.authenticatedRequest(USER_ACTIVITY_URL,
|
accountManager.authenticatedRequest(USER_ACTIVITY_URL,
|
||||||
QNetworkAccessManager::PostOperation,
|
QNetworkAccessManager::PostOperation,
|
||||||
|
@ -68,8 +66,8 @@ void UserActivityLogger::requestError(QNetworkReply::NetworkError error,const QS
|
||||||
qDebug() << error << ": " << string;
|
qDebug() << error << ": " << string;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserActivityLogger::login() {
|
void UserActivityLogger::launch() {
|
||||||
const QString ACTION_NAME = "login";
|
const QString ACTION_NAME = "launch";
|
||||||
QJsonObject actionDetails;
|
QJsonObject actionDetails;
|
||||||
|
|
||||||
QString OS_KEY = "OS";
|
QString OS_KEY = "OS";
|
||||||
|
@ -91,9 +89,9 @@ void UserActivityLogger::login() {
|
||||||
logAction(ACTION_NAME, actionDetails);
|
logAction(ACTION_NAME, actionDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserActivityLogger::logout() {
|
void UserActivityLogger::close(JSONCallbackParameters params) {
|
||||||
const QString ACTION_NAME = "";
|
const QString ACTION_NAME = "close";
|
||||||
logAction(ACTION_NAME);
|
logAction(ACTION_NAME, QJsonObject(), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserActivityLogger::changedDisplayName(QString displayName) {
|
void UserActivityLogger::changedDisplayName(QString displayName) {
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#ifndef hifi_UserActivityLogger_h
|
#ifndef hifi_UserActivityLogger_h
|
||||||
#define hifi_UserActivityLogger_h
|
#define hifi_UserActivityLogger_h
|
||||||
|
|
||||||
|
#include "AccountManager.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
@ -24,10 +26,10 @@ public:
|
||||||
static UserActivityLogger& getInstance();
|
static UserActivityLogger& getInstance();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void logAction(QString action, QJsonObject details = QJsonObject());
|
void logAction(QString action, QJsonObject details = QJsonObject(), JSONCallbackParameters params = JSONCallbackParameters());
|
||||||
|
|
||||||
void login();
|
void launch();
|
||||||
void logout();
|
void close(JSONCallbackParameters params = JSONCallbackParameters());
|
||||||
void changedDisplayName(QString displayName);
|
void changedDisplayName(QString displayName);
|
||||||
void changedModel(QString typeOfModel, QString modelURL);
|
void changedModel(QString typeOfModel, QString modelURL);
|
||||||
void changedDomain(QString domainURL);
|
void changedDomain(QString domainURL);
|
||||||
|
|
Loading…
Reference in a new issue