Commits

minirop committed 5dd2746

logger function

  • Participants
  • Parent commits a370cd0

Comments (0)

Files changed (2)

+#include "Logger.h"
+
+QFile logFile("kvns.log");
+bool canOpen = true;
+
+void Log(const QString & string)
+{
+	if(!canOpen)
+		return;
+	
+	if(!logFile.isWritable())
+	{
+		canOpen = logFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Unbuffered);
+		if(!canOpen)
+			return;
+	}
+	
+	logFile.write(string.toAscii() + "\n");
+}
+#ifndef LOGGER_H
+#define LOGGER_H
+
+#include <QFile>
+
+extern QFile logFile;
+
+void Log(const QString &);
+
+#endif