forked from quickshell/quickshell
core/log: add custom log encoder for smaller log storage
Will be used to store more detailed logs in the future without using as much disk space.
This commit is contained in:
parent
8364e94d26
commit
bdbf5b9af9
9 changed files with 980 additions and 87 deletions
|
@ -61,6 +61,7 @@ int qs_main(int argc, char** argv) {
|
|||
auto workdirOption = QCommandLineOption({"d", "workdir"}, "Initial working directory.", "path");
|
||||
auto debugPortOption = QCommandLineOption("debugport", "Enable the QML debugger.", "port");
|
||||
auto debugWaitOption = QCommandLineOption("waitfordebug", "Wait for debugger connection before launching.");
|
||||
auto readLogOption = QCommandLineOption("read-log", "Read a quickshell log file to stdout.", "path");
|
||||
// clang-format on
|
||||
|
||||
parser.addOption(currentOption);
|
||||
|
@ -70,8 +71,22 @@ int qs_main(int argc, char** argv) {
|
|||
parser.addOption(workdirOption);
|
||||
parser.addOption(debugPortOption);
|
||||
parser.addOption(debugWaitOption);
|
||||
parser.addOption(readLogOption);
|
||||
parser.process(app);
|
||||
|
||||
auto logOption = parser.value(readLogOption);
|
||||
if (!logOption.isEmpty()) {
|
||||
auto file = QFile(logOption);
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
qCritical() << "Failed to open log for reading:" << logOption;
|
||||
return -1;
|
||||
} else {
|
||||
qInfo() << "Reading log" << logOption;
|
||||
}
|
||||
|
||||
return qs::log::readEncodedLogs(&file) ? 0 : -1;
|
||||
}
|
||||
|
||||
auto debugPortStr = parser.value(debugPortOption);
|
||||
if (!debugPortStr.isEmpty()) {
|
||||
auto ok = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue