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