mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 04:54:29 -04:00
Add support for printing more information in diagnosis log
Also yacreaderlibraryserver can now print this with the --system-info option This will help when giving support to users.
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_libraries.h"
|
||||
#include "yacreader_local_server.h"
|
||||
#include "global_info_provider.h"
|
||||
|
||||
#include "libraries_update_coordinator.h"
|
||||
|
||||
@ -88,6 +89,7 @@ int main(int argc, char **argv)
|
||||
parser.addPositionalArgument("command", "The command to execute. [start, create-library, update-library, add-library, remove-library, list-libraries, set-port, rescan-xml-info]");
|
||||
parser.addOption({ "loglevel", "Set log level. Valid values: trace, info, debug, warn, error.", "loglevel", "info" });
|
||||
parser.addOption({ "port", "Set server port (temporary). Valid values: 1-65535", "port" });
|
||||
parser.addOption({ "system-info", "Prints detailed information about the system environment, including OS version, hardware specifications, and available resources." });
|
||||
parser.parse(app.arguments());
|
||||
|
||||
const QStringList args = parser.positionalArguments();
|
||||
@ -100,6 +102,15 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parser.isSet("system-info")) {
|
||||
auto globalInfo = YACReader::getGlobalInfo();
|
||||
for (const auto &line : globalInfo.split("\n")) {
|
||||
qout << line << Qt::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QSettings *settings = new QSettings(settingsPath, QSettings::IniFormat);
|
||||
settings->beginGroup("libraryConfig");
|
||||
|
||||
@ -444,8 +455,10 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
|
||||
void logSystemAndConfig()
|
||||
{
|
||||
QLOG_INFO() << "---------- System & configuration ----------";
|
||||
QLOG_INFO() << "OS:" << QSysInfo::prettyProductName() << "Version: " << QSysInfo::productVersion();
|
||||
QLOG_INFO() << "Kernel:" << QSysInfo::kernelType() << QSysInfo::kernelVersion() << "Architecture:" << QSysInfo::currentCpuArchitecture();
|
||||
auto globalInfo = YACReader::getGlobalInfo();
|
||||
for (const auto &line : globalInfo.split("\n")) {
|
||||
QLOG_INFO() << line;
|
||||
}
|
||||
QLOG_INFO() << "Libraries: " << DBHelper::getLibraries().getLibraries();
|
||||
QLOG_INFO() << "--------------------------------------------";
|
||||
}
|
||||
|
Reference in New Issue
Block a user