Browse Source

打印的日志显示毫秒

master
tianzhendong 4 weeks ago
parent
commit
d504f9ce33
  1. 2
      loghandler.cpp

2
loghandler.cpp

@ -55,7 +55,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
int index = fileName.lastIndexOf(QDir::separator()); int index = fileName.lastIndexOf(QDir::separator());
fileName = fileName.mid(index + 1); fileName = fileName.mid(index + 1);
QString msgOut = QString("%1 - [%2] (%3:%4, %5): %6") QString msgOut = QString("%1 - [%2] (%3:%4, %5): %6")
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss")).arg(level) .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz")).arg(level)
.arg(fileName).arg(context.line).arg(context.function).arg(msg); .arg(fileName).arg(context.line).arg(context.function).arg(msg);
std::cout << msgOut.toLocal8Bit().constData() << std::endl; std::cout << msgOut.toLocal8Bit().constData() << std::endl;
QTextStream in(&g_file); QTextStream in(&g_file);

Loading…
Cancel
Save