重构qDebug()<<,使log输出到文件
#include <QProcessEnvironment>
#include <QDateTime>
#include <QFile>
#include <QIODevice>
class HSDbg
{
public:
HSDbg& operator<<(const QString& str)
{
QTextStream txtOutput(&qtLogfile);
if(qtLogfile.open(QIODevice::Append | QIODevice::Text))
{
qDebug() << str;
txtOutput << str << "\n";
qtLogfile.close();
}
return *this;
}
HSDbg&