3 @author: Sudheer K. <scifi1947 at gmail.com>
4 @license: GNU General Public License
11 #include <QTextStream>
15 class LogUtility : public QObject
20 LogUtility(QString logPath,QObject *parent = 0) :
22 logFilePath = logPath;
29 void logMessage(QString strMessage, bool appendMode = true) {
31 QFile logFile(logFilePath);
36 success = logFile.open(QIODevice::Append | QIODevice::WriteOnly | QIODevice::Text);
39 success = logFile.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text);
42 QString strTimeNow = QDateTime::currentDateTime().toString("dd-MMM-yyyy HH:mm:ss");
44 QTextStream logStream(&logFile);
45 logStream << strTimeNow << " - " << strMessage << endl;
48 qDebug() << "ERROROPENINGLOGFILE" << " - " << strMessage;
56 #endif // LOGUTILITY_H