aboutsummaryrefslogtreecommitdiff
path: root/src/Logger/openlogfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Logger/openlogfile.cpp')
-rw-r--r--src/Logger/openlogfile.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Logger/openlogfile.cpp b/src/Logger/openlogfile.cpp
new file mode 100644
index 0000000..349d058
--- /dev/null
+++ b/src/Logger/openlogfile.cpp
@@ -0,0 +1,21 @@
+#include "logger.h"
+
+bool Logger::openLogFile()
+{
+ // verify that there is no open logfile already
+ if ( _logFile.openMode() == QIODevice::NotOpen)
+ {
+ // set new log file
+ _logFile.setFileName(_logPath + "/" + _logFileName);
+ return _logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
+ }
+ // else:
+ // file already open, can not get a lock
+ return false;
+}
+
+void Logger::closeLogFile()
+{
+ // close file if open. if already closed, ignore.
+ _logFile.close();
+}