Commit 1e3db639 authored by Don Gagne's avatar Don Gagne

Better console log to file support

parent 671a615a
......@@ -335,6 +335,7 @@ void QGCApplication::_shutdown(void)
QGCApplication::~QGCApplication()
{
// Place shutdown code in _shutdown
_app = NULL;
}
void QGCApplication::_initCommon(void)
......
......@@ -92,7 +92,8 @@ void AppLogModel::threadsafeLog(const QString message)
insertRows(line, 1);
setData(index(line), message, Qt::DisplayRole);
if (_logFile.fileName().isEmpty() && qgcApp()->logOutput()) {
if (qgcApp() && qgcApp()->logOutput() && _logFile.fileName().isEmpty()) {
qDebug() << _logFile.fileName().isEmpty() << qgcApp()->logOutput();
QGCToolbox* toolbox = qgcApp()->toolbox();
// Be careful of toolbox not being open yet
if (toolbox) {
......@@ -110,5 +111,6 @@ void AppLogModel::threadsafeLog(const QString message)
if (_logFile.isOpen()) {
QTextStream out(&_logFile);
out << message << "\n";
_logFile.flush();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment