mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
Logger should also output to stderr
This commit is contained in:
parent
022f1cabe7
commit
20eff29432
@ -4,6 +4,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
class MyLogger: public Logger { };
|
class MyLogger: public Logger { };
|
||||||
Q_GLOBAL_STATIC(MyLogger, loggerInstance)
|
Q_GLOBAL_STATIC(MyLogger, loggerInstance)
|
||||||
@ -56,6 +57,9 @@ void Logger::messageHandler(QtMsgType type, const QMessageLogContext &, const QS
|
|||||||
// Get time and date
|
// Get time and date
|
||||||
auto timestamp = QDateTime::currentDateTime().toString();
|
auto timestamp = QDateTime::currentDateTime().toString();
|
||||||
// Write message
|
// Write message
|
||||||
logger->m_file.write(QString("[%1] (%2): %4\n").arg(typeString, timestamp, msg).toStdString().c_str());
|
const std::string out = QString("[%1] (%2): %4\n").arg(typeString, timestamp, msg).toStdString();
|
||||||
|
logger->m_file.write(out.c_str());
|
||||||
logger->m_file.flush();
|
logger->m_file.flush();
|
||||||
|
std::cerr << out;
|
||||||
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user