MayaFlux 0.4.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 Nexus, ///< Spatial indexing and scheduling for user-defined behaviour
49 USER, ///< User code, scripts, plugins
51};
52
53/**
54 * @enum Context
55 * @brief Execution contexts for log messages.
56 *
57 * Represents the computational domain and thread context where a log message originates.
58 * This enables context-aware filtering, real-time safety validation, and performance analysis.
59 */
60enum class Context : uint8_t {
61 // ============================================================================
62 // REAL-TIME CONTEXTS (must never block, allocate, or throw)
63 // ============================================================================
64
65 AudioCallback, ///< Audio callback thread - strictest real-time requirements
66 GraphicsCallback, ///< Graphics/visual rendering callback - frame-rate real-time
67 Realtime, ///< Any real-time processing context (generic)
68
69 // ============================================================================
70 // BACKEND CONTEXTS
71 // ============================================================================
72
73 AudioBackend, ///< Audio processing backend (RtAudio, JACK, ASIO)
74 GraphicsBackend, ///< Graphics/visual rendering backend (Vulkan, OpenGL)
75 InputBackend, ///< Input device backend (HID, MIDI, OSC)
76 NetworkBackend, ///< Network transport backend (UDP, TCP, SHM)
77 CustomBackend, ///< Custom user-defined backend
78
79 // ============================================================================
80 // GPU CONTEXTS
81 // ============================================================================
82 GPUCompute, ///< GPU compute operations (shaders, GPGPU tasks)
83 Rendering, ///< GPU rendering operations (graphics pipeline, frame rendering)
84
85 // ============================================================================
86 // SUBSYSTEM CONTEXTS
87 // ============================================================================
88
89 AudioSubsystem, ///< Audio subsystem operations (backend, device, stream management)
90 WindowingSubsystem, ///< Windowing system operations (GLFW, SDL)
91 GraphicsSubsystem, ///< Graphics subsystem operations (Vulkan, rendering pipeline)
92 InputSubsystem, ///< Input subsystem operations (device management, event dispatch)
93 NetworkSubsystem, ///< Network subsystem operations (endpoint management, data routing)
94 CustomSubsystem, ///< Custom user-defined subsystem
95
96 // ============================================================================
97 // PROCESSING CONTEXTS
98 // ============================================================================
99
100 NodeProcessing, ///< Node graph processing (Nodes::NodeGraphManager)
101 BufferProcessing, ///< Buffer processing (Buffers::BufferManager, processing chains)
102 BufferManagement, ///< Buffer Management (Buffers::BufferManager, creating buffers)
103 InputManagement, ///< Input management (Core::InputManager)
104 CoroutineScheduling, ///< Coroutine scheduling and temporal coordination (Vruta::TaskScheduler)
105 ContainerProcessing, ///< Container operations (Kakshya - file/stream/region processing)
106 ComputeMatrix, ///< Compute operations (Yantra - algorithms, matrices, DSP)
107 ImageProcessing, ///< Image processing tasks (filters, transformations)
108 ShaderCompilation, ///< Shader compilation tasks (Portal::Graphics::ShaderCompiler)
109
110 // ============================================================================
111 // WORKER CONTEXTS
112 // ============================================================================
113
114 Worker, ///< Background worker thread (non-real-time scheduled tasks)
115 AsyncIO, ///< Async I/O operations ( network, streaming)
116 FileIO, ///< Filesystem I/O operations
117 BackgroundCompile, ///< Background compilation/optimization tasks
118 Networking, ///< Network operations (data transfer, protocol handling)
119
120 // ============================================================================
121 // LIFECYCLE CONTEXTS
122 // ============================================================================
123
124 Init, ///< Engine/subsystem initialization
125 Shutdown, ///< Engine/subsystem shutdown and cleanup
126 Configuration, ///< Configuration and parameter updates
127
128 // ============================================================================
129 // USER INTERACTION CONTEXTS
130 // ============================================================================
131
132 UI, ///< User interface thread (UI events, rendering)
133 UserCode, ///< User script/plugin execution
134 Interactive, ///< Interactive shell/REPL
135
136 // ============================================================================
137 // COORDINATION CONTEXTS
138 // ============================================================================
139
140 CrossSubsystem, ///< Cross-subsystem data sharing and synchronization
141 ClockSync, ///< Clock synchronization (SampleClock, FrameClock coordination)
142 EventDispatch, ///< Event dispatching and coordination
143
144 // ============================================================================
145 // SPECIAL CONTEXTS
146 // ============================================================================
147
148 Runtime, ///< General runtime operations (default fallback)
149 Testing, ///< Testing/benchmarking context
150 API, ///< API calls from external code
151 Unknown ///< Unknown or unspecified context
152};
153
154/**
155 * @brief A log entry structure to encapsulate log message details.
156 */
157struct MAYAFLUX_API JournalEntry {
161 std::string_view message;
162 std::source_location location;
163 std::chrono::steady_clock::time_point timestamp;
164
166 std::string_view msg,
167 std::source_location loc = std::source_location::current())
168 : severity(sev)
169 , component(comp)
170 , context(ctx)
171 , message(msg)
172 , location(loc)
173 , timestamp(std::chrono::steady_clock::now())
174 {
175 }
176
177 static inline std::string severity_to_string(Severity sev)
178 {
179 return std::string(Reflect::enum_to_string(sev));
180 }
181
182 static inline std::string component_to_string(Component comp)
183 {
184 return std::string(Reflect::enum_to_string(comp));
185 }
186
187 static inline std::string context_to_string(Context ctx)
188 {
189 return std::string(Reflect::enum_to_string(ctx));
190 }
191};
192
193}
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)
@ NetworkBackend
Network transport backend (UDP, TCP, SHM)
@ AudioCallback
Audio callback thread - strictest real-time requirements.
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ NetworkSubsystem
Network subsystem operations (endpoint management, data routing)
@ 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.
@ Networking
Network operations (data transfer, protocol handling)
@ 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.
@ Nexus
Spatial indexing and scheduling for user-defined behaviour.
@ 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.