FOSSredder 0.5.0
Loading...
Searching...
No Matches
MainWindowTrace.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <string>
9#include <utility>
10
11#include <QString>
12#include <QStringList>
13
15
16namespace ui::window {
17
23inline core::errors::ErrorContext makePathContext(const QString& path) {
24 return {{ui::observability::context::kPath, path.toStdString()}};
25}
26
33makeFileListContext(const QStringList& files) {
35 {ui::observability::context::kCount, std::to_string(files.size())}};
36 if (!files.isEmpty())
37 context.emplace_back(ui::observability::context::kFirstFile,
38 files.front().toStdString());
39 return context;
40}
41
51 const char* origin, std::string message,
53 core::errors::ErrorContext context = {}) {
54 ui::observability::reportFlow(reporter, severity,
56 origin, std::move(message), std::move(context));
57}
58
59} // namespace ui::window
Declarations for the UI Trace component.
Port for reporting structured diagnostic error events.
ErrorSeverity
Severity level for structured error events.
Definition ErrorEvent.h:17
std::vector< std::pair< std::string, std::string > > ErrorContext
Key/value context attached to an error event.
Definition ErrorEvent.h:27
constexpr auto kFirstFile
Definition Trace.h:27
constexpr auto kPath
Definition Trace.h:35
constexpr auto kCount
Definition Trace.h:23
void reportFlow(core::ports::diagnostics::IErrorReporter *reporter, core::errors::ErrorSeverity severity, const char *code, const char *origin, std::string message, core::errors::ErrorContext context={})
Reports a UI flow error event.
Definition Trace.h:132
void reportMainWindowFlow(core::ports::diagnostics::IErrorReporter *reporter, const char *origin, std::string message, core::errors::ErrorSeverity severity=core::errors::ErrorSeverity::Info, core::errors::ErrorContext context={})
Emits a structured main-window flow diagnostic.
core::errors::ErrorContext makePathContext(const QString &path)
Builds trace context for a single filesystem path.
core::errors::ErrorContext makeFileListContext(const QStringList &files)
Builds trace context for a list of selected or dropped files.