mirror of
https://github.com/lubosz/overte.git
synced 2025-08-12 23:59:05 +02:00
Resolved FB#5005
This commit is contained in:
parent
dd3a7f7249
commit
fce3badd1d
2 changed files with 14 additions and 1 deletions
|
@ -20,6 +20,10 @@
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include "AddressManager.h"
|
#include "AddressManager.h"
|
||||||
|
|
||||||
|
UserActivityLogger::UserActivityLogger() {
|
||||||
|
_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
UserActivityLogger& UserActivityLogger::getInstance() {
|
UserActivityLogger& UserActivityLogger::getInstance() {
|
||||||
static UserActivityLogger sharedInstance;
|
static UserActivityLogger sharedInstance;
|
||||||
return sharedInstance;
|
return sharedInstance;
|
||||||
|
@ -43,6 +47,12 @@ void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCall
|
||||||
actionPart.setBody(QByteArray().append(action));
|
actionPart.setBody(QByteArray().append(action));
|
||||||
multipart->append(actionPart);
|
multipart->append(actionPart);
|
||||||
|
|
||||||
|
// Log the local-time that this event was logged
|
||||||
|
QHttpPart elapsedPart;
|
||||||
|
elapsedPart.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"elapsed_ms\"");
|
||||||
|
elapsedPart.setBody(QByteArray().append(_timer.elapsed()));
|
||||||
|
multipart->append(elapsedPart);
|
||||||
|
|
||||||
// If there are action details, add them to the multipart
|
// If there are action details, add them to the multipart
|
||||||
if (!details.isEmpty()) {
|
if (!details.isEmpty()) {
|
||||||
QHttpPart detailsPart;
|
QHttpPart detailsPart;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
#include "AddressManager.h"
|
#include "AddressManager.h"
|
||||||
|
@ -51,8 +52,10 @@ private slots:
|
||||||
void requestError(QNetworkReply& errorReply);
|
void requestError(QNetworkReply& errorReply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UserActivityLogger() {};
|
UserActivityLogger();
|
||||||
Setting::Handle<bool> _disabled { "UserActivityLoggerDisabled", false };
|
Setting::Handle<bool> _disabled { "UserActivityLoggerDisabled", false };
|
||||||
|
|
||||||
|
QElapsedTimer _timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_UserActivityLogger_h
|
#endif // hifi_UserActivityLogger_h
|
||||||
|
|
Loading…
Reference in a new issue