#include <QDateTime>#include <QFile>#include <QTextCodec>
QFile m_logFile;
void logMsg(const QString &str)
{
m_logFile.setFileName("./***.log");
m_logFile.open(QIODevice::ReadWrite | QIODevice::Append | QIODevice::Text);
m_logFile.write((QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ") + str + "\r\n").toLocal8Bit().data());
m_logFile.flush();
m_logFile.close();
}