mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Commit for Better Logger - WL 21537
This commit is contained in:
parent
ca00349abc
commit
b953c49461
3 changed files with 22 additions and 3 deletions
|
@ -510,6 +510,13 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt
|
|||
OutputDebugStringA(logMessage.toLocal8Bit().constData());
|
||||
OutputDebugStringA("\n");
|
||||
#endif
|
||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||
auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr;
|
||||
|
||||
QUuid fileLoggerSessionID = myAvatar->getSessionUUID();
|
||||
if (!fileLoggerSessionID.isNull()) {
|
||||
qApp->getLogger()->setSessionID(fileLoggerSessionID);
|
||||
}
|
||||
qApp->getLogger()->addMessage(qPrintable(logMessage + "\n"));
|
||||
}
|
||||
}
|
||||
|
@ -804,6 +811,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
_deadlockWatchdogThread = new DeadlockWatchdogThread();
|
||||
_deadlockWatchdogThread->start();
|
||||
|
||||
// Set File Logger Session UUID
|
||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||
auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr;
|
||||
|
||||
if (steamClient) {
|
||||
qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << steamClient->getSteamVRBuildID();
|
||||
}
|
||||
|
@ -920,8 +931,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
// send a location update immediately
|
||||
discoverabilityManager->updateLocation();
|
||||
|
||||
auto myAvatar = getMyAvatar();
|
||||
|
||||
connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded);
|
||||
connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled);
|
||||
connect(nodeList.data(), &NodeList::nodeActivated, this, &Application::nodeActivated);
|
||||
|
|
|
@ -48,6 +48,8 @@ static const QString LOGS_DIRECTORY = "Logs";
|
|||
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 FILENAME_WILDCARD = "hifi-log_" + IPADDR_WILDCARD + "_" + DATETIME_WILDCARD + ".txt";
|
||||
static QUuid& SESSION_ID = QUuid::QUuid("{00000000-0000-0000-0000-000000000000}");
|
||||
|
||||
// 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.
|
||||
static const qint64 MAX_LOG_SIZE = 512 * 1024;
|
||||
|
@ -62,7 +64,10 @@ QString getLogRollerFilename() {
|
|||
QString result = FileUtils::standardPath(LOGS_DIRECTORY);
|
||||
QHostAddress clientAddress = getGuessedLocalAddress();
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
result.append(QString(FILENAME_FORMAT).arg(clientAddress.toString(), now.toString(DATETIME_FORMAT)));
|
||||
|
||||
auto FILE_SESSION_ID = SESSION_ID.toString().replace("{", "").replace("}", "");
|
||||
|
||||
result.append(QString(FILENAME_FORMAT).arg(FILE_SESSION_ID, now.toString(DATETIME_FORMAT)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -142,6 +147,10 @@ FileLogger::~FileLogger() {
|
|||
_persistThreadInstance->terminate();
|
||||
}
|
||||
|
||||
void FileLogger::setSessionID(const QUuid& message) {
|
||||
SESSION_ID = message; // This is for the output of log files. It will change if the Avatar enters a different domain.
|
||||
}
|
||||
|
||||
void FileLogger::addMessage(const QString& message) {
|
||||
_persistThreadInstance->queueItem(message);
|
||||
emit logReceived(message);
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
|
||||
QString getFilename() const { return _fileName; }
|
||||
virtual void addMessage(const QString&) override;
|
||||
virtual void setSessionID(const QUuid&);
|
||||
virtual QString getLogData() override;
|
||||
virtual void locateLog() override;
|
||||
virtual void sync() override;
|
||||
|
|
Loading…
Reference in a new issue