mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 01:24:05 +02:00
Merge pull request #13399 from kitely/roll-log-on-startup
Always roll hifi-log.txt when starting
This commit is contained in:
commit
c1d949351e
1 changed files with 4 additions and 4 deletions
|
@ -30,7 +30,7 @@ signals:
|
|||
void rollingLogFile(QString newFilename);
|
||||
|
||||
protected:
|
||||
void rollFileIfNecessary(QFile& file, bool notifyListenersIfRolled = true);
|
||||
void rollFileIfNecessary(QFile& file, bool force = false, bool notifyListenersIfRolled = true);
|
||||
virtual bool processQueueItems(const Queue& messages) override;
|
||||
|
||||
private:
|
||||
|
@ -79,12 +79,12 @@ FilePersistThread::FilePersistThread(const FileLogger& logger) : _logger(logger)
|
|||
// A file may exist from a previous run - if it does, roll the file and suppress notifying listeners.
|
||||
QFile file(_logger._fileName);
|
||||
if (file.exists()) {
|
||||
rollFileIfNecessary(file, false);
|
||||
rollFileIfNecessary(file, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
void FilePersistThread::rollFileIfNecessary(QFile& file, bool notifyListenersIfRolled) {
|
||||
if (file.size() > MAX_LOG_SIZE) {
|
||||
void FilePersistThread::rollFileIfNecessary(QFile& file, bool force, bool notifyListenersIfRolled) {
|
||||
if (force || (file.size() > MAX_LOG_SIZE)) {
|
||||
QString newFileName = getLogRollerFilename();
|
||||
if (file.copy(newFileName)) {
|
||||
file.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
||||
|
|
Loading…
Reference in a new issue