feat(logs): narrate what pacman and flatpak really run
Changing screen is not an operation, and a navigation line per click buried the entries that matter. Providers now narrate the work itself instead: the exact command, the fallbacks and the counts, through a Qt-free trace sink that reaches the journal only, so the status bar stays short.
This commit is contained in:
8 files changed
+157
-48
No files matched your search
+17
-9
@@ -15,6 +15,7 @@
|
||||
#include "app-logging.h"
|
||||
#include "log-manager.h"
|
||||
#include "plugin-package.h"
|
||||
#include "provider-trace.h"
|
||||
#include "workers.h"
|
||||
|
||||
namespace {
|
||||
@@ -98,6 +99,17 @@ AppCore::AppCore(QObject* parent) : QObject(parent) {
|
||||
qRegisterMetaType<std::vector<PackageInfo>>("std::vector<PackageInfo>");
|
||||
qRegisterMetaType<AppCore::ListMode>("AppCore::ListMode");
|
||||
|
||||
// Provider narration — the exact commands run and the decisions around
|
||||
// them — goes to the journal and nowhere else: it is detail to read after
|
||||
// the fact, not something to flash in the status bar while an operation
|
||||
// runs. Providers reach it through a Qt-free sink so they keep building
|
||||
// into the headless tests.
|
||||
provider_trace::setSink(
|
||||
[](const std::string& source, const std::string& message) {
|
||||
LogManager::instance().logEvent(QString::fromStdString(source),
|
||||
QString::fromStdString(message));
|
||||
});
|
||||
|
||||
// Plugin registry: pacman is compiled in; every other plugin (Flatpak,
|
||||
// AUR, ...) ships as an external shared library loaded at runtime from the
|
||||
// plugins/ directories.
|
||||
@@ -798,15 +810,11 @@ AppCore::StartResult AppCore::startAction(InstallWorker* worker, const Request&
|
||||
|
||||
qCInfo(pacmgrOp) << request.action << QString::fromStdString(request.package.name);
|
||||
|
||||
// Journal header: what is about to run, so the raw output that follows reads
|
||||
// like a hand-run command. A file install logs the file it acted on.
|
||||
const QString target = request.path.isEmpty()
|
||||
? QString::fromStdString(request.package.name)
|
||||
: request.path;
|
||||
LogManager::instance().beginCommand(
|
||||
providerLabel(providers), request.action,
|
||||
target.isEmpty() ? QString()
|
||||
: QStringLiteral("%1 %2").arg(request.action, target));
|
||||
// Journal header: which provider(s) and action, so the raw output that
|
||||
// follows reads like a hand-run session. No synthesized command line here:
|
||||
// `request.action target` is not what actually runs — the provider reports
|
||||
// its real command line right after the header, through the trace sink.
|
||||
LogManager::instance().beginCommand(providerLabel(providers), request.action);
|
||||
|
||||
connect(worker, &InstallWorker::progress, this,
|
||||
[this](const QString& message) {
|
||||
|
||||
Reference in new issue
Block a user