diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-07-18 20:25:41 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-07-19 11:13:03 +0900 |
commit | 915b760d54d072f1d6ad805a3a963dc7c0ec6f70 (patch) | |
tree | 4ecc4ddb5939073ede01f4a431a81034d2e04ac8 /mobile-widgets | |
parent | 883063875e253a1cf944c5f524d46ec9ab0b796d (diff) | |
download | subsurface-915b760d54d072f1d6ad805a3a963dc7c0ec6f70.tar.gz |
Android: truncate logfile and add date
Trucate the logfile on open to remove any data from previous sessions.
This confused me very much, as the new logfile started from the
top, leaving old data on the bottom.
Also added system date for easy reference.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 5066c589a..b84b83430 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -11,6 +11,7 @@ #include <QApplication> #include <QElapsedTimer> #include <QTimer> +#include <QDateTime> #include "qt-models/divelistmodel.h" #include "qt-models/gpslistmodel.h" @@ -97,12 +98,14 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), #if defined(Q_OS_ANDROID) appLogFileName = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).first() + "/subsurface.log"; appLogFile.setFileName(appLogFileName); - if (!appLogFile.open(QIODevice::ReadWrite)) { + if (!appLogFile.open(QIODevice::ReadWrite|QIODevice::Truncate)) { appLogFileOpen = false; - appendTextToLog("Failed to open logfile" + appLogFileName); + appendTextToLog("Failed to open logfile " + appLogFileName + + " at " + QDateTime::currentDateTime().toString()); } else { appLogFileOpen = true; - appendTextToLog("Successfully opened logfile" + appLogFileName); + appendTextToLog("Successfully opened logfile " + appLogFileName + + " at " + QDateTime::currentDateTime().toString()); } #endif appendTextToLog("Starting " + getUserAgent()); |