MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
JournalEntry.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include "chrono"
6#include "source_location"
7#include "string_view"
8
9#ifdef MAYAFLUX_PLATFORM_WINDOWS
10#ifdef ERROR
11#undef ERROR
12#endif // ERROR
13#endif // MAYAFLUX_PLATFORM_WINDOWS
14
15namespace MayaFlux::Journal {
16
17/**
18 * @enum Log Severity
19 * @brief Severity levels for log messages.
20 */
21enum class Severity : uint8_t {
22 TRACE,
23 DEBUG,
24 INFO,
25 WARN,
26 ERROR,
27 FATAL,
28 NONE
29};
30
31/**
32 * @enum Namespace Component
33 * @brief Components of the system for categorizing log messages.
34 */
35enum class Component : uint8_t {
36 API, ///< MayaFlux/API Wrapper and convenience functions
37 Buffers, ///< Buffers, Managers, processors and processing chains
38 Core, ///< Core engine, backend, subsystems
39 Kakshya, ///< Containers[Signalsource, Stream, File], Regions, DataProcessors
40 Kriya, ///< Automatable tasks and fluent scheduling api for Nodes and Buffers
41 Nodes, ///< DSP Generator and Filter Nodes, graph pipeline, node management
42 Vruta, ///< Coroutines, schedulers, clocks, task management
43 Yantra, ///< DSP algorithms, computational units, matrix operations, Grammar
44 IO, ///< Networking, file handling, streaming
45 Registry, ///< Backend and service registry
46 Portal, ///< High-level user-facing API layer
47 Kinesis, ///< General mathematical and physics algorithns.
48 USER, ///< User code, scripts, plugins
50};
51
52/**
53 * @enum Context
54 * @brief Execution contexts for log messages.
55 *
56 * Represents the computational domain and thread context where a log message originates.
57 * This enables context-aware filtering, real-time safety validation, and performance analysis.
58 */
59enum class Context : uint8_t {
60 // ============================================================================
61 // REAL-TIME CONTEXTS (must never block, allocate, or throw)
62 // ============================================================================
63
64 AudioCallback, ///< Audio callback thread - strictest real-time requirements
65 GraphicsCallback, ///< Graphics/visual rendering callback - frame-rate real-time
66 Realtime, ///< Any real-time processing context (generic)
67
68 // ============================================================================
69 // BACKEND CONTEXTS
70 // ============================================================================
71
72 AudioBackend, ///< Audio processing backend (RtAudio, JACK, ASIO)
73 GraphicsBackend, ///< Graphics/visual rendering backend (Vulkan, OpenGL)
74 InputBackend, ///< Input device backend (HID, MIDI, OSC)
75 CustomBackend, ///< Custom user-defined backend
76
77 // ============================================================================
78 // GPU CONTEXTS
79 // ============================================================================
80 GPUCompute, ///< GPU compute operations (shaders, GPGPU tasks)
81 Rendering, ///< GPU rendering operations (graphics pipeline, frame rendering)
82
83 // ============================================================================
84 // SUBSYSTEM CONTEXTS
85 // ============================================================================
86
87 AudioSubsystem, ///< Audio subsystem operations (backend, device, stream management)
88 WindowingSubsystem, ///< Windowing system operations (GLFW, SDL)
89 GraphicsSubsystem, ///< Graphics subsystem operations (Vulkan, rendering pipeline)
90 InputSubsystem, ///< Input subsystem operations (device management, event dispatch)
91 CustomSubsystem, ///< Custom user-defined subsystem
92
93 // ============================================================================
94 // PROCESSING CONTEXTS
95 // ============================================================================
96
97 NodeProcessing, ///< Node graph processing (Nodes::NodeGraphManager)
98 BufferProcessing, ///< Buffer processing (Buffers::BufferManager, processing chains)
99 BufferManagement, ///< Buffer Management (Buffers::BufferManager, creating buffers)
100 InputManagement, ///< Input management (Core::InputManager)
101 CoroutineScheduling, ///< Coroutine scheduling and temporal coordination (Vruta::TaskScheduler)
102 ContainerProcessing, ///< Container operations (Kakshya - file/stream/region processing)
103 ComputeMatrix, ///< Compute operations (Yantra - algorithms, matrices, DSP)
104 ImageProcessing, ///< Image processing tasks (filters, transformations)
105 ShaderCompilation, ///< Shader compilation tasks (Portal::Graphics::ShaderCompiler)
106
107 // ============================================================================
108 // WORKER CONTEXTS
109 // ============================================================================
110
111 Worker, ///< Background worker thread (non-real-time scheduled tasks)
112 AsyncIO, ///< Async I/O operations ( network, streaming)
113 FileIO, ///< Filesystem I/O operations
114 BackgroundCompile, ///< Background compilation/optimization tasks
115
116 // ============================================================================
117 // LIFECYCLE CONTEXTS
118 // ============================================================================
119
120 Init, ///< Engine/subsystem initialization
121 Shutdown, ///< Engine/subsystem shutdown and cleanup
122 Configuration, ///< Configuration and parameter updates
123
124 // ============================================================================
125 // USER INTERACTION CONTEXTS
126 // ============================================================================
127
128 UI, ///< User interface thread (UI events, rendering)
129 UserCode, ///< User script/plugin execution
130 Interactive, ///< Interactive shell/REPL
131
132 // ============================================================================
133 // COORDINATION CONTEXTS
134 // ============================================================================
135
136 CrossSubsystem, ///< Cross-subsystem data sharing and synchronization
137 ClockSync, ///< Clock synchronization (SampleClock, FrameClock coordination)
138 EventDispatch, ///< Event dispatching and coordination
139
140 // ============================================================================
141 // SPECIAL CONTEXTS
142 // ============================================================================
143
144 Runtime, ///< General runtime operations (default fallback)
145 Testing, ///< Testing/benchmarking context
146 API, ///< API calls from external code
147 Unknown ///< Unknown or unspecified context
148};
149
150/**
151 * @brief A log entry structure to encapsulate log message details.
152 */
153struct MAYAFLUX_API JournalEntry {
157 std::string_view message;
158 std::source_location location;
159 std::chrono::steady_clock::time_point timestamp;
160
162 std::string_view msg,
163 std::source_location loc = std::source_location::current())
164 : severity(sev)
165 , component(comp)
166 , context(ctx)
167 , message(msg)
168 , location(loc)
169 , timestamp(std::chrono::steady_clock::now())
170 {
171 }
172
173 static inline std::string severity_to_string(Severity sev)
174 {
175 return std::string(Reflect::enum_to_string(sev));
176 }
177
178 static inline std::string component_to_string(Component comp)
179 {
180 return std::string(Reflect::enum_to_string(comp));
181 }
182
183 static inline std::string context_to_string(Context ctx)
184 {
185 return std::string(Reflect::enum_to_string(ctx));
186 }
187};
188
189}
Context
Execution contexts for log messages.
@ AudioBackend
Audio processing backend (RtAudio, JACK, ASIO)
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP)
@ CustomBackend
Custom user-defined backend.
@ EventDispatch
Event dispatching and coordination.
@ CrossSubsystem
Cross-subsystem data sharing and synchronization.
@ UserCode
User script/plugin execution.
@ Shutdown
Engine/subsystem shutdown and cleanup.
@ Interactive
Interactive shell/REPL.
@ Configuration
Configuration and parameter updates.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ BufferManagement
Buffer Management (Buffers::BufferManager, creating buffers)
@ AudioSubsystem
Audio subsystem operations (backend, device, stream management)
@ AudioCallback
Audio callback thread - strictest real-time requirements.
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Worker
Background worker thread (non-real-time scheduled tasks)
@ ClockSync
Clock synchronization (SampleClock, FrameClock coordination)
@ UI
User interface thread (UI events, rendering)
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ BackgroundCompile
Background compilation/optimization tasks.
@ FileIO
Filesystem I/O operations.
@ InputManagement
Input management (Core::InputManager)
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Init
Engine/subsystem initialization.
@ Realtime
Any real-time processing context (generic)
@ AsyncIO
Async I/O operations ( network, streaming)
@ Rendering
GPU rendering operations (graphics pipeline, frame rendering)
@ CoroutineScheduling
Coroutine scheduling and temporal coordination (Vruta::TaskScheduler)
@ WindowingSubsystem
Windowing system operations (GLFW, SDL)
@ GPUCompute
GPU compute operations (shaders, GPGPU tasks)
@ Runtime
General runtime operations (default fallback)
@ GraphicsSubsystem
Graphics subsystem operations (Vulkan, rendering pipeline)
@ GraphicsCallback
Graphics/visual rendering callback - frame-rate real-time.
@ ImageProcessing
Image processing tasks (filters, transformations)
@ InputBackend
Input device backend (HID, MIDI, OSC)
@ InputSubsystem
Input subsystem operations (device management, event dispatch)
@ ShaderCompilation
Shader compilation tasks (Portal::Graphics::ShaderCompiler)
@ CustomSubsystem
Custom user-defined subsystem.
@ Testing
Testing/benchmarking context.
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
@ Vruta
Coroutines, schedulers, clocks, task management.
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.
@ USER
User code, scripts, plugins.
@ Portal
High-level user-facing API layer.
@ Buffers
Buffers, Managers, processors and processing chains.
@ Registry
Backend and service registry.
@ Kinesis
General mathematical and physics algorithns.
@ Core
Core engine, backend, subsystems.
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
@ IO
Networking, file handling, streaming.
@ API
MayaFlux/API Wrapper and convenience functions.
@ Kriya
Automatable tasks and fluent scheduling api for Nodes and Buffers.
JournalEntry(Severity sev, Component comp, Context ctx, std::string_view msg, std::source_location loc=std::source_location::current())
std::chrono::steady_clock::time_point timestamp
static std::string component_to_string(Component comp)
static std::string severity_to_string(Severity sev)
static std::string context_to_string(Context ctx)
A log entry structure to encapsulate log message details.