Ref T773, clear log when written, set object name for logger

This commit is contained in:
Klaus Basan
2020-02-12 21:45:51 +01:00
committed by Mat Sutcliffe
parent f6c5e6f3cb
commit a629b70724
4 changed files with 12 additions and 4 deletions

View File

@@ -445,7 +445,8 @@ namespace BlackCore
this->clearInterpolationLogCallsigns();
// write
m_interpolationLogger.writeLogInBackground();
const bool clearLog = true;
m_interpolationLogger.writeLogInBackground(clearLog);
CLogMessage(this).info(u"Started writing interpolation log");
return true;
}
@@ -687,6 +688,8 @@ namespace BlackCore
CIdentifiable(this)
{
this->setObjectName("Simulator: " + pluginInfo.getIdentifier());
m_interpolationLogger.setObjectName("Logger: " + pluginInfo.getIdentifier());
ISimulator::registerHelp();
// provider signals, hook up with remote aircraft provider

View File

@@ -45,7 +45,7 @@ namespace BlackMisc
return cats;
}
CWorker *CInterpolationLogger::writeLogInBackground()
CWorker *CInterpolationLogger::writeLogInBackground(bool clearLog)
{
QList<SituationLog> situations;
QList<PartsLog> parts;
@@ -58,10 +58,13 @@ namespace BlackMisc
parts = m_partsLogs;
}
CWorker *worker = CWorker::fromTask(this, "WriteInterpolationLog", [situations, parts]()
QPointer<CInterpolationLogger> myself(this);
CWorker *worker = CWorker::fromTask(this, "WriteInterpolationLog", [situations, parts, myself, clearLog]()
{
const CStatusMessageList msg = CInterpolationLogger::writeLogFiles(situations, parts);
CLogMessage::preformatted(msg);
if (clearLog && myself) { myself->clearLog(); }
});
return worker;
}

View File

@@ -104,7 +104,7 @@ namespace BlackMisc
static const CLogCategoryList &getLogCategories();
//! Write a log in background
CWorker *writeLogInBackground();
CWorker *writeLogInBackground(bool clearLog);
//! Clear log file
void clearLog();

View File

@@ -481,6 +481,8 @@ namespace BlackSimPlugin
// update provider, own name, title
this->updateOwnModel(settings.getOwnModel());
this->setObjectName(simulator);
m_interpolationLogger.setObjectName("Logger (emulated driver): " + simulator.toQString());
if (m_monitorWidget) { m_monitorWidget->updateWindowTitleAndUiValues(simulator); }
}