Add dynamic logging filter elements for core and plugins in the livelog view
This commit is contained in:
parent
dc6c4b88df
commit
b4f32c073a
@ -263,7 +263,7 @@ button::-moz-focus-inner { border: 0; }
|
|||||||
.categories-area {
|
.categories-area {
|
||||||
display: -webkit-flex;
|
display: -webkit-flex;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row nowrap;
|
flex-flow: row wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.debug-category {
|
.debug-category {
|
||||||
@ -335,11 +335,11 @@ button::-moz-focus-inner { border: 0; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
input:checked + .slider {
|
input:checked + .slider {
|
||||||
background-color: #2196F3;
|
background-color: #57baae;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:focus + .slider {
|
input:focus + .slider {
|
||||||
box-shadow: 0 0 1px #2196F3;
|
box-shadow: 0 0 1px #57baae;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:checked + .slider:before {
|
input:checked + .slider:before {
|
||||||
|
|||||||
@ -1720,42 +1720,62 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
|
|||||||
writer.writeCharacters("");
|
writer.writeCharacters("");
|
||||||
writer.writeEndElement(); // textarea
|
writer.writeEndElement(); // textarea
|
||||||
|
|
||||||
|
writer.writeEmptyElement("hr");
|
||||||
|
//: The network section of the debug interface
|
||||||
|
writer.writeTextElement("h2", tr("Logging filters"));
|
||||||
|
writer.writeEmptyElement("hr");
|
||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "categories-area");
|
writer.writeAttribute("class", "categories-area");
|
||||||
|
|
||||||
// Application debug category
|
QStringList loggingCategories = NymeaCore::loggingFilters();
|
||||||
writer.writeStartElement("div");
|
loggingCategories.sort();
|
||||||
writer.writeAttribute("class", "debug-category");
|
|
||||||
writer.writeTextElement("p", "Application");
|
foreach (const QString &loggingCategory, loggingCategories) {
|
||||||
writer.writeStartElement("label");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "switch");
|
writer.writeAttribute("class", "debug-category");
|
||||||
writer.writeStartElement("input");
|
writer.writeTextElement("p", loggingCategory);
|
||||||
writer.writeAttribute("type", "checkbox");
|
writer.writeStartElement("label");
|
||||||
writer.writeEndElement(); // input
|
writer.writeAttribute("class", "switch");
|
||||||
writer.writeStartElement("span");
|
writer.writeStartElement("input");
|
||||||
writer.writeAttribute("class", "slider round");
|
writer.writeAttribute("type", "checkbox");
|
||||||
writer.writeCharacters("");
|
writer.writeEndElement(); // input
|
||||||
writer.writeEndElement(); // span
|
writer.writeStartElement("span");
|
||||||
writer.writeEndElement(); // label
|
writer.writeAttribute("class", "slider round");
|
||||||
writer.writeEndElement(); // div debug-category
|
writer.writeCharacters("");
|
||||||
|
writer.writeEndElement(); // span
|
||||||
|
writer.writeEndElement(); // label
|
||||||
|
writer.writeEndElement(); // div debug-category
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.writeEndElement(); // div categories-area
|
||||||
|
|
||||||
|
writer.writeEmptyElement("hr");
|
||||||
|
//: The network section of the debug interface
|
||||||
|
writer.writeTextElement("h2", tr("Logging filters plugins"));
|
||||||
|
writer.writeEmptyElement("hr");
|
||||||
|
|
||||||
writer.writeStartElement("div");
|
writer.writeStartElement("div");
|
||||||
writer.writeAttribute("class", "debug-category");
|
writer.writeAttribute("class", "categories-area");
|
||||||
writer.writeTextElement("p", "DeviceManager");
|
|
||||||
writer.writeStartElement("label");
|
|
||||||
writer.writeAttribute("class", "switch");
|
|
||||||
writer.writeStartElement("input");
|
|
||||||
writer.writeAttribute("type", "checkbox");
|
|
||||||
writer.writeEndElement(); // input
|
|
||||||
writer.writeStartElement("span");
|
|
||||||
writer.writeAttribute("class", "slider round");
|
|
||||||
writer.writeCharacters("");
|
|
||||||
writer.writeEndElement(); // span
|
|
||||||
writer.writeEndElement(); // label
|
|
||||||
writer.writeEndElement(); // div debug-category
|
|
||||||
|
|
||||||
|
QStringList loggingCategoriesPlugins = NymeaCore::loggingFiltersPlugins();
|
||||||
// Provide options for debug categories
|
loggingCategoriesPlugins.sort();
|
||||||
|
foreach (const QString &loggingCategory, loggingCategoriesPlugins) {
|
||||||
|
writer.writeStartElement("div");
|
||||||
|
writer.writeAttribute("class", "debug-category");
|
||||||
|
writer.writeTextElement("p", loggingCategory);
|
||||||
|
writer.writeStartElement("label");
|
||||||
|
writer.writeAttribute("class", "switch");
|
||||||
|
writer.writeStartElement("input");
|
||||||
|
writer.writeAttribute("type", "checkbox");
|
||||||
|
writer.writeEndElement(); // input
|
||||||
|
writer.writeStartElement("span");
|
||||||
|
writer.writeAttribute("class", "slider round");
|
||||||
|
writer.writeCharacters("");
|
||||||
|
writer.writeEndElement(); // span
|
||||||
|
writer.writeEndElement(); // label
|
||||||
|
writer.writeEndElement(); // div debug-category
|
||||||
|
}
|
||||||
|
|
||||||
writer.writeEndElement(); // div categories-area
|
writer.writeEndElement(); // div categories-area
|
||||||
|
|
||||||
|
|||||||
@ -690,6 +690,65 @@ QStringList NymeaCore::getAvailableLanguages()
|
|||||||
return availableLanguages;
|
return availableLanguages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Returns the list of logging categories from the core and the libnymea. */
|
||||||
|
QStringList NymeaCore::loggingFilters()
|
||||||
|
{
|
||||||
|
QStringList loggingFilters = {
|
||||||
|
"Warnings",
|
||||||
|
"Application",
|
||||||
|
"System",
|
||||||
|
"Platform",
|
||||||
|
"PlatformUpdate",
|
||||||
|
"PlatformZeroConf",
|
||||||
|
"Device",
|
||||||
|
"DeviceManager",
|
||||||
|
"RuleEngine",
|
||||||
|
"RuleEngineDebug",
|
||||||
|
"Hardware",
|
||||||
|
"Bluetooth",
|
||||||
|
"LogEngine",
|
||||||
|
"ServerManager",
|
||||||
|
"TcpServer",
|
||||||
|
"TcpServerTraffic",
|
||||||
|
"WebServer",
|
||||||
|
"WebServerTraffic",
|
||||||
|
"DebugServer",
|
||||||
|
"WebSocketServer",
|
||||||
|
"WebSocketServerTraffic",
|
||||||
|
"JsonRpc",
|
||||||
|
"JsonRpcTraffic",
|
||||||
|
"Rest",
|
||||||
|
"OAuth2",
|
||||||
|
"TimeManager",
|
||||||
|
"Coap",
|
||||||
|
"Avahi",
|
||||||
|
"AvahiDebug",
|
||||||
|
"UPnP",
|
||||||
|
"Cloud",
|
||||||
|
"CloudTraffic",
|
||||||
|
"NetworkManager",
|
||||||
|
"UserManager",
|
||||||
|
"AWS",
|
||||||
|
"AWSTraffic",
|
||||||
|
"BluetoothServer",
|
||||||
|
"BluetoothServerTraffic",
|
||||||
|
"Mqtt",
|
||||||
|
"Translations"
|
||||||
|
};
|
||||||
|
|
||||||
|
return loggingFilters;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList NymeaCore::loggingFiltersPlugins()
|
||||||
|
{
|
||||||
|
QStringList loggingFiltersPlugins;
|
||||||
|
foreach (const QJsonObject &pluginMetadata, DeviceManagerImplementation::pluginsMetadata()) {
|
||||||
|
QString pluginName = pluginMetadata.value("name").toString();
|
||||||
|
loggingFiltersPlugins << pluginName.left(1).toUpper() + pluginName.mid(1);
|
||||||
|
}
|
||||||
|
return loggingFiltersPlugins;
|
||||||
|
}
|
||||||
|
|
||||||
/*! Returns a pointer to the \l{BluetoothServer} instance owned by NymeaCore. */
|
/*! Returns a pointer to the \l{BluetoothServer} instance owned by NymeaCore. */
|
||||||
BluetoothServer *NymeaCore::bluetoothServer() const
|
BluetoothServer *NymeaCore::bluetoothServer() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -96,6 +96,8 @@ public:
|
|||||||
Platform *platform() const;
|
Platform *platform() const;
|
||||||
|
|
||||||
static QStringList getAvailableLanguages();
|
static QStringList getAvailableLanguages();
|
||||||
|
static QStringList loggingFilters();
|
||||||
|
static QStringList loggingFiltersPlugins();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void initialized();
|
void initialized();
|
||||||
|
|||||||
@ -97,55 +97,9 @@ int main(int argc, char *argv[])
|
|||||||
application.setApplicationName("nymead");
|
application.setApplicationName("nymead");
|
||||||
application.setApplicationVersion(NYMEA_VERSION_STRING);
|
application.setApplicationVersion(NYMEA_VERSION_STRING);
|
||||||
|
|
||||||
// logging filers for core and libnymea
|
// Logging filers for core + libnymea and plugins
|
||||||
QStringList loggingFilters = {
|
QStringList loggingFilters = NymeaCore::loggingFilters();
|
||||||
"Warnings",
|
QStringList loggingFiltersPlugins = NymeaCore::loggingFiltersPlugins();
|
||||||
"Application",
|
|
||||||
"System",
|
|
||||||
"Platform",
|
|
||||||
"PlatformUpdate",
|
|
||||||
"PlatformZeroConf",
|
|
||||||
"Device",
|
|
||||||
"DeviceManager",
|
|
||||||
"RuleEngine",
|
|
||||||
"RuleEngineDebug",
|
|
||||||
"Hardware",
|
|
||||||
"Bluetooth",
|
|
||||||
"LogEngine",
|
|
||||||
"ServerManager",
|
|
||||||
"TcpServer",
|
|
||||||
"TcpServerTraffic",
|
|
||||||
"WebServer",
|
|
||||||
"WebServerTraffic",
|
|
||||||
"DebugServer",
|
|
||||||
"WebSocketServer",
|
|
||||||
"WebSocketServerTraffic",
|
|
||||||
"JsonRpc",
|
|
||||||
"JsonRpcTraffic",
|
|
||||||
"Rest",
|
|
||||||
"OAuth2",
|
|
||||||
"TimeManager",
|
|
||||||
"Coap",
|
|
||||||
"Avahi",
|
|
||||||
"AvahiDebug",
|
|
||||||
"UPnP",
|
|
||||||
"Cloud",
|
|
||||||
"CloudTraffic",
|
|
||||||
"NetworkManager",
|
|
||||||
"UserManager",
|
|
||||||
"AWS",
|
|
||||||
"AWSTraffic",
|
|
||||||
"BluetoothServer",
|
|
||||||
"BluetoothServerTraffic",
|
|
||||||
"Mqtt",
|
|
||||||
"Translations"
|
|
||||||
};
|
|
||||||
|
|
||||||
QStringList loggingFiltersPlugins;
|
|
||||||
foreach (const QJsonObject &pluginMetadata, DeviceManagerImplementation::pluginsMetadata()) {
|
|
||||||
QString pluginName = pluginMetadata.value("name").toString();
|
|
||||||
loggingFiltersPlugins << pluginName.left(1).toUpper() + pluginName.mid(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Translator for the server application
|
// Translator for the server application
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
|
|||||||
Reference in New Issue
Block a user