[Companion] Add optional logging of all debug output. (#4974)

* [AppDebugMessageHandler] Add ability to write debug output to any number of QIODevices.

* [Simulator][DebugOutput] Use new QIODevice hook in AppDebugMessageHandler instead of signal/slot.

* [AppData] Add new settings for debug logging; Refactor property creation macro to work with any data type and add varName_init() method to set default; Refactor all boolean settings to use new macro (others to be migrated later).

* [AppPreferencesDialog] Add UI for appDebugLog, fwTraceLog, & appLogsDir settings; Clean up layout on application prefs. tab, move and re-label a couple items.

* [Companion][Simulator] Enable optional application debug output logging.

* [Simulator] Enable optional logging of firmware debug output to file.

* [EEPROMInterface] Use qDebug() instead of std::cout so that now all debug output can be routed via custom message handler/logger.

* [Companion][Simulator] Add missing #include.
This commit is contained in:
Max Paperno
2017-06-10 23:33:03 +02:00
committed by Bertrand Songis
parent 2e4775b19a
commit f50ee3fb39
16 changed files with 680 additions and 498 deletions
+7 -12
View File
@@ -94,8 +94,11 @@ DebugOutput::DebugOutput(QWidget * parent, SimulatorInterface *simulator):
connect(ui->actionToggleFilter, &QAction::toggled, this, &DebugOutput::onFilterToggled);
connect(ui->filterText, &QComboBox::currentTextChanged, this, &DebugOutput::onFilterTextChanged);
if (AppDebugMessageHandler::instance())
connect(AppDebugMessageHandler::instance(), &AppDebugMessageHandler::messageOutput, this, &DebugOutput::onAppDebugMessage);
if (AppDebugMessageHandler::instance()) {
// send application Info/Warning/Error events to our data collector
m_dataBufferDevice->setProperty("level", 1);
AppDebugMessageHandler::instance()->addOutputDevice(m_dataBufferDevice);
}
// send firmware TRACE events to our data collector
m_simulator->addTracebackDevice(m_dataBufferDevice);
@@ -103,10 +106,9 @@ DebugOutput::DebugOutput(QWidget * parent, SimulatorInterface *simulator):
DebugOutput::~DebugOutput()
{
if (AppDebugMessageHandler::instance())
disconnect(AppDebugMessageHandler::instance(), 0, this, 0);
if (m_dataBufferDevice) {
if (AppDebugMessageHandler::instance())
AppDebugMessageHandler::instance()->removeOutputDevice(m_dataBufferDevice);
m_simulator->removeTracebackDevice(m_dataBufferDevice);
disconnect(m_dataBufferDevice, 0, this, 0);
disconnect(this, 0, m_dataBufferDevice, 0);
@@ -201,13 +203,6 @@ void DebugOutput::onDataBufferOverflow(const qint64 len)
}
}
void DebugOutput::onAppDebugMessage(quint8 level, const QString & msg)
{
if (level > 0 && m_dataBufferDevice) {
m_dataBufferDevice->write(qPrintable(msg % "\n"));
}
}
/*
* UI handlers
*/