Merge pull request #257 from odysseus654/pr/logging

Separate user activity logging from crash logging
This commit is contained in:
kasenvr 2020-05-06 14:20:50 -04:00 committed by GitHub
commit 84d80582d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 3 deletions

View file

@ -603,6 +603,12 @@ Menu::Menu() {
false,
&UserActivityLogger::getInstance(),
SLOT(disable(bool)));
addCheckableActionToQMenuAndActionHash(networkMenu,
MenuOption::DisableCrashLogger,
0,
false,
&UserActivityLogger::getInstance(),
SLOT(crashMonitorDisable(bool)));
addActionToQMenuAndActionHash(networkMenu, MenuOption::ShowDSConnectTable, 0,
qApp, SLOT(loadDomainConnectionDialog()));

View file

@ -86,6 +86,7 @@ namespace MenuOption {
const QString DeleteAvatarEntitiesBookmark = "Delete Avatar Entities Bookmark";
const QString DeleteBookmark = "Delete Bookmark...";
const QString DisableActivityLogger = "Disable Activity Logger";
const QString DisableCrashLogger = "Disable Crash Logger";
const QString DisableEyelidAdjustment = "Disable Eyelid Adjustment";
const QString DisableLightEntities = "Disable Light Entities";
const QString DisplayCrashOptions = "Display Crash Options";

View file

@ -218,12 +218,12 @@ int main(int argc, const char* argv[]) {
}
qDebug() << "UserActivityLogger is enabled:" << ual.isEnabled();
if (ual.isEnabled()) {
qDebug() << "Crash handler logger is enabled:" << ual.isCrashMonitorEnabled();
if (ual.isCrashMonitorEnabled()) {
auto crashHandlerStarted = startCrashHandler(argv[0]);
qDebug() << "Crash handler started:" << crashHandlerStarted;
}
const QString& applicationName = getInterfaceSharedMemoryName();
bool instanceMightBeRunning = true;
#ifdef Q_OS_WIN

View file

@ -254,7 +254,15 @@ void setupPreferences() {
auto setter = [](bool value) { Menu::getInstance()->setIsOptionChecked(MenuOption::DisableActivityLogger, !value); };
preferences->addPreference(new CheckPreference("Privacy", "Send data - High Fidelity uses information provided by your "
"client to improve the product through the logging of errors, tracking of usage patterns, "
"installation and system details, and crash events. By allowing High Fidelity to collect "
"installation and system details. By allowing High Fidelity to collect this information "
"you are helping to improve the product. ", getter, setter));
}
{
auto getter = []()->bool { return !Menu::getInstance()->isOptionChecked(MenuOption::DisableCrashLogger); };
auto setter = [](bool value) { Menu::getInstance()->setIsOptionChecked(MenuOption::DisableCrashLogger, !value); };
preferences->addPreference(new CheckPreference("Privacy", "Send crashes - Vircadia uses information provided by your "
"client to improve the product through crash reports. By allowing Vircadia to collect "
"this information you are helping to improve the product. ", getter, setter));
}

View file

@ -34,6 +34,10 @@ void UserActivityLogger::disable(bool disable) {
_disabled.set(disable);
}
void UserActivityLogger::crashMonitorDisable(bool disable) {
_crashMonitorDisabled.set(disable);
}
void UserActivityLogger::logAction(QString action, QJsonObject details, JSONCallbackParameters params) {
// qCDebug(networking).nospace() << ">>> UserActivityLogger::logAction(" << action << "," << QJsonDocument(details).toJson();
// This logs what the UserActivityLogger would normally send to centralized servers.

View file

@ -35,7 +35,11 @@ public slots:
bool isEnabled() { return !_disabled.get(); }
bool isDisabledSettingSet() const { return _disabled.isSet(); }
bool isCrashMonitorEnabled() { return !_crashMonitorDisabled.get(); }
bool isCrashMonitorDisabledSettingSet() const { return _crashMonitorDisabled.isSet(); }
void disable(bool disable);
void crashMonitorDisable(bool disable);
void logAction(QString action, QJsonObject details = QJsonObject(), JSONCallbackParameters params = JSONCallbackParameters());
void launch(QString applicationVersion, bool previousSessionCrashed, int previousSessionRuntime);
@ -55,6 +59,7 @@ private slots:
private:
UserActivityLogger();
Setting::Handle<bool> _disabled { "UserActivityLoggerDisabled", true };
Setting::Handle<bool> _crashMonitorDisabled { "CrashMonitorDisabled", false };
QElapsedTimer _timer;
};