mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 21:03:27 +02:00
Merge pull request #11326 from cain-kilgore/21537
WL 21537 - Improve log naming
This commit is contained in:
commit
9c06afc4c8
4 changed files with 34 additions and 13 deletions
|
@ -797,8 +797,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
installNativeEventFilter(&MyNativeEventFilter::getInstance());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_logger = new FileLogger(this); // After setting organization name in order to get correct directory
|
|
||||||
|
_logger = new FileLogger(this);
|
||||||
qInstallMessageHandler(messageHandler);
|
qInstallMessageHandler(messageHandler);
|
||||||
|
|
||||||
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
|
QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
|
||||||
|
@ -814,6 +814,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
(new DeadlockWatchdogThread())->start();
|
(new DeadlockWatchdogThread())->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set File Logger Session UUID
|
||||||
|
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||||
|
auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr;
|
||||||
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
|
||||||
|
_logger->setSessionID(accountManager->getSessionID());
|
||||||
|
|
||||||
if (steamClient) {
|
if (steamClient) {
|
||||||
qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID();
|
qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID();
|
||||||
}
|
}
|
||||||
|
@ -930,8 +937,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
// send a location update immediately
|
// send a location update immediately
|
||||||
discoverabilityManager->updateLocation();
|
discoverabilityManager->updateLocation();
|
||||||
|
|
||||||
auto myAvatar = getMyAvatar();
|
|
||||||
|
|
||||||
connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded);
|
connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded);
|
||||||
connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled);
|
connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled);
|
||||||
connect(nodeList.data(), &NodeList::nodeActivated, this, &Application::nodeActivated);
|
connect(nodeList.data(), &NodeList::nodeActivated, this, &Application::nodeActivated);
|
||||||
|
@ -942,9 +947,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
// you might think we could just do this in NodeList but we only want this connection for Interface
|
// you might think we could just do this in NodeList but we only want this connection for Interface
|
||||||
connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
|
connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
|
||||||
|
|
||||||
// connect to appropriate slots on AccountManager
|
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
|
||||||
|
|
||||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||||
connect(accountManager.data(), &AccountManager::authRequired, dialogsManager.data(), &DialogsManager::showLoginDialog);
|
connect(accountManager.data(), &AccountManager::authRequired, dialogsManager.data(), &DialogsManager::showLoginDialog);
|
||||||
connect(accountManager.data(), &AccountManager::usernameChanged, this, &Application::updateWindowTitle);
|
connect(accountManager.data(), &AccountManager::usernameChanged, this, &Application::updateWindowTitle);
|
||||||
|
@ -2100,7 +2102,6 @@ Application::~Application() {
|
||||||
_octreeProcessor.terminate();
|
_octreeProcessor.terminate();
|
||||||
_entityEditSender.terminate();
|
_entityEditSender.terminate();
|
||||||
|
|
||||||
|
|
||||||
DependencyManager::destroy<AvatarManager>();
|
DependencyManager::destroy<AvatarManager>();
|
||||||
DependencyManager::destroy<AnimationCache>();
|
DependencyManager::destroy<AnimationCache>();
|
||||||
DependencyManager::destroy<FramebufferCache>();
|
DependencyManager::destroy<FramebufferCache>();
|
||||||
|
|
|
@ -381,7 +381,7 @@ class AvatarData : public QObject, public SpatiallyNestable {
|
||||||
|
|
||||||
Q_PROPERTY(QStringList jointNames READ getJointNames)
|
Q_PROPERTY(QStringList jointNames READ getJointNames)
|
||||||
|
|
||||||
Q_PROPERTY(QUuid sessionUUID READ getSessionUUID)
|
Q_PROPERTY(QUuid sessionUUID READ getSessionUUID NOTIFY sessionUUIDChanged)
|
||||||
|
|
||||||
Q_PROPERTY(glm::mat4 sensorToWorldMatrix READ getSensorToWorldMatrix)
|
Q_PROPERTY(glm::mat4 sensorToWorldMatrix READ getSensorToWorldMatrix)
|
||||||
Q_PROPERTY(glm::mat4 controllerLeftHandMatrix READ getControllerLeftHandMatrix)
|
Q_PROPERTY(glm::mat4 controllerLeftHandMatrix READ getControllerLeftHandMatrix)
|
||||||
|
@ -670,13 +670,19 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void displayNameChanged();
|
void displayNameChanged();
|
||||||
void lookAtSnappingChanged(bool enabled);
|
void lookAtSnappingChanged(bool enabled);
|
||||||
|
void sessionUUIDChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendAvatarDataPacket();
|
void sendAvatarDataPacket();
|
||||||
void sendIdentityPacket();
|
void sendIdentityPacket();
|
||||||
|
|
||||||
void setJointMappingsFromNetworkReply();
|
void setJointMappingsFromNetworkReply();
|
||||||
void setSessionUUID(const QUuid& sessionUUID) { setID(sessionUUID); }
|
void setSessionUUID(const QUuid& sessionUUID) {
|
||||||
|
if (sessionUUID != getID()) {
|
||||||
|
setID(sessionUUID);
|
||||||
|
emit sessionUUIDChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override;
|
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const override;
|
||||||
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const override;
|
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const override;
|
||||||
|
|
|
@ -26,7 +26,6 @@ class FilePersistThread : public GenericQueueThread < QString > {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FilePersistThread(const FileLogger& logger);
|
FilePersistThread(const FileLogger& logger);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void rollingLogFile(QString newFilename);
|
void rollingLogFile(QString newFilename);
|
||||||
|
|
||||||
|
@ -42,12 +41,14 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const QString FILENAME_FORMAT = "hifi-log_%1_%2.txt";
|
static const QString FILENAME_FORMAT = "hifi-log_%1%2.txt";
|
||||||
static const QString DATETIME_FORMAT = "yyyy-MM-dd_hh.mm.ss";
|
static const QString DATETIME_FORMAT = "yyyy-MM-dd_hh.mm.ss";
|
||||||
static const QString LOGS_DIRECTORY = "Logs";
|
static const QString LOGS_DIRECTORY = "Logs";
|
||||||
static const QString IPADDR_WILDCARD = "[0-9]*.[0-9]*.[0-9]*.[0-9]*";
|
static const QString IPADDR_WILDCARD = "[0-9]*.[0-9]*.[0-9]*.[0-9]*";
|
||||||
static const QString DATETIME_WILDCARD = "20[0-9][0-9]-[0,1][0-9]-[0-3][0-9]_[0-2][0-9].[0-6][0-9].[0-6][0-9]";
|
static const QString DATETIME_WILDCARD = "20[0-9][0-9]-[0,1][0-9]-[0-3][0-9]_[0-2][0-9].[0-6][0-9].[0-6][0-9]";
|
||||||
static const QString FILENAME_WILDCARD = "hifi-log_" + IPADDR_WILDCARD + "_" + DATETIME_WILDCARD + ".txt";
|
static const QString FILENAME_WILDCARD = "hifi-log_" + IPADDR_WILDCARD + "_" + DATETIME_WILDCARD + ".txt";
|
||||||
|
static QUuid SESSION_ID;
|
||||||
|
|
||||||
// Max log size is 512 KB. We send log files to our crash reporter, so we want to keep this relatively
|
// Max log size is 512 KB. We send log files to our crash reporter, so we want to keep this relatively
|
||||||
// small so it doesn't go over the 2MB zipped limit for all of the files we send.
|
// small so it doesn't go over the 2MB zipped limit for all of the files we send.
|
||||||
static const qint64 MAX_LOG_SIZE = 512 * 1024;
|
static const qint64 MAX_LOG_SIZE = 512 * 1024;
|
||||||
|
@ -62,7 +63,13 @@ QString getLogRollerFilename() {
|
||||||
QString result = FileUtils::standardPath(LOGS_DIRECTORY);
|
QString result = FileUtils::standardPath(LOGS_DIRECTORY);
|
||||||
QHostAddress clientAddress = getGuessedLocalAddress();
|
QHostAddress clientAddress = getGuessedLocalAddress();
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
result.append(QString(FILENAME_FORMAT).arg(clientAddress.toString(), now.toString(DATETIME_FORMAT)));
|
QString fileSessionID;
|
||||||
|
|
||||||
|
if (!SESSION_ID.isNull()) {
|
||||||
|
fileSessionID = "_" + SESSION_ID.toString().replace("{", "").replace("}", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(QString(FILENAME_FORMAT).arg(now.toString(DATETIME_FORMAT), fileSessionID));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +149,12 @@ FileLogger::~FileLogger() {
|
||||||
_persistThreadInstance->terminate();
|
_persistThreadInstance->terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileLogger::setSessionID(const QUuid& message) {
|
||||||
|
// This is for the output of log files. Once the application is first started,
|
||||||
|
// this function runs and grabs the AccountManager Session ID and saves it here.
|
||||||
|
SESSION_ID = message;
|
||||||
|
}
|
||||||
|
|
||||||
void FileLogger::addMessage(const QString& message) {
|
void FileLogger::addMessage(const QString& message) {
|
||||||
_persistThreadInstance->queueItem(message);
|
_persistThreadInstance->queueItem(message);
|
||||||
emit logReceived(message);
|
emit logReceived(message);
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
|
|
||||||
QString getFilename() const { return _fileName; }
|
QString getFilename() const { return _fileName; }
|
||||||
virtual void addMessage(const QString&) override;
|
virtual void addMessage(const QString&) override;
|
||||||
|
virtual void setSessionID(const QUuid&);
|
||||||
virtual QString getLogData() override;
|
virtual QString getLogData() override;
|
||||||
virtual void locateLog() override;
|
virtual void locateLog() override;
|
||||||
virtual void sync() override;
|
virtual void sync() override;
|
||||||
|
|
Loading…
Reference in a new issue