FOSSredder 0.5.0
Loading...
Searching...
No Matches
Trace.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <string>
9#include <utility>
10
16
17namespace ui::observability {
18
19namespace context {
20
21inline constexpr auto kArtifactCount = "artifactCount";
22inline constexpr auto kColumn = "column";
23inline constexpr auto kCount = "count";
24inline constexpr auto kError = "error";
25inline constexpr auto kException = "exception";
26inline constexpr auto kFile = "file";
27inline constexpr auto kFirstFile = "firstFile";
28inline constexpr auto kFormat = "format";
29inline constexpr auto kIncludeFormulas = "includeFormulas";
30inline constexpr auto kId = "id";
31inline constexpr auto kLine = "line";
32inline constexpr auto kLocale = "locale";
33inline constexpr auto kName = "name";
34inline constexpr auto kOperation = "operation";
35inline constexpr auto kPath = "path";
36inline constexpr auto kQueuedCount = "queuedCount";
37inline constexpr auto kRunRoot = "runRoot";
38inline constexpr auto kSelectionId = "selectionId";
39inline constexpr auto kStatus = "status";
40inline constexpr auto kUrl = "url";
41
42} // namespace context
43
44namespace layer {
45
46inline constexpr auto kAdapter = "adapter";
47inline constexpr auto kComposition = "composition";
48inline constexpr auto kViewModel = "viewmodel";
49inline constexpr auto kWorkflow = "workflow";
50inline constexpr auto kWorkspace = "workspace";
51
52} // namespace layer
53
58bool isTraceEnabled();
66void trace(const char* layer, const char* origin, std::string message,
68
75inline void traceAdapter(const char* origin, std::string message,
77 trace(layer::kAdapter, origin, std::move(message), std::move(context));
78}
79
86inline void traceComposition(const char* origin, std::string message,
88 trace(layer::kComposition, origin, std::move(message), std::move(context));
89}
90
97inline void traceViewModel(const char* origin, std::string message,
99 trace(layer::kViewModel, origin, std::move(message), std::move(context));
100}
101
108inline void traceWorkflow(const char* origin, std::string message,
110 trace(layer::kWorkflow, origin, std::move(message), std::move(context));
111}
112
119inline void traceWorkspace(const char* origin, std::string message,
121 trace(layer::kWorkspace, origin, std::move(message), std::move(context));
122}
123
133 core::errors::ErrorSeverity severity, const char* code,
134 const char* origin, std::string message,
136 core::errors::report(reporter, severity, code, origin, std::move(message),
137 std::move(context));
138}
139
148 core::errors::ErrorSeverity severity, const char* origin,
149 std::string message,
151 reportFlow(reporter, severity, core::errors::codes::GenericError, origin,
152 std::move(message), std::move(context));
153}
154
155} // namespace ui::observability
Declares structured error event payloads.
Provides shared helpers for reporting structured errors and exceptions.
Declares the structured diagnostics reporting port.
Port for reporting structured diagnostic error events.
Defines shared structured error codes.
constexpr const char * GenericError
Fallback code for generic structured errors.
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
void report(core::ports::diagnostics::IErrorReporter *reporter, const ErrorEvent &event)
Report an already constructed error event when a reporter exists.
constexpr auto kFirstFile
Definition Trace.h:27
constexpr auto kRunRoot
Definition Trace.h:37
constexpr auto kQueuedCount
Definition Trace.h:36
constexpr auto kFormat
Definition Trace.h:28
constexpr auto kColumn
Definition Trace.h:22
constexpr auto kUrl
Definition Trace.h:40
constexpr auto kPath
Definition Trace.h:35
constexpr auto kSelectionId
Definition Trace.h:38
constexpr auto kException
Definition Trace.h:25
constexpr auto kStatus
Definition Trace.h:39
constexpr auto kLocale
Definition Trace.h:32
constexpr auto kArtifactCount
Definition Trace.h:21
constexpr auto kIncludeFormulas
Definition Trace.h:29
constexpr auto kName
Definition Trace.h:33
constexpr auto kOperation
Definition Trace.h:34
constexpr auto kLine
Definition Trace.h:31
constexpr auto kId
Definition Trace.h:30
constexpr auto kError
Definition Trace.h:24
constexpr auto kCount
Definition Trace.h:23
constexpr auto kFile
Definition Trace.h:26
constexpr auto kAdapter
Definition Trace.h:46
constexpr auto kViewModel
Definition Trace.h:48
constexpr auto kWorkspace
Definition Trace.h:50
constexpr auto kComposition
Definition Trace.h:47
constexpr auto kWorkflow
Definition Trace.h:49
void traceViewModel(const char *origin, std::string message, core::errors::ErrorContext context={})
Emits a view model trace event.
Definition Trace.h:97
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 traceWorkflow(const char *origin, std::string message, core::errors::ErrorContext context={})
Emits a workflow trace event.
Definition Trace.h:108
bool isTraceEnabled()
Reports whether UI trace emission is enabled.
Definition Trace.cpp:56
void traceComposition(const char *origin, std::string message, core::errors::ErrorContext context={})
Emits a composition trace event.
Definition Trace.h:86
void traceWorkspace(const char *origin, std::string message, core::errors::ErrorContext context={})
Emits a workspace trace event.
Definition Trace.h:119
void trace(const char *layer, const char *origin, std::string message, core::errors::ErrorContext context={})
Emits a UI trace event.
Definition Trace.cpp:60
void traceAdapter(const char *origin, std::string message, core::errors::ErrorContext context={})
Emits an adapter trace event.
Definition Trace.h:75
Declarations for the UI ErrorCodes component.