MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
RealtimeEntry.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "JournalEntry.hpp"
4
5namespace MayaFlux::Journal {
6
7/**
8 * @brief Lightweight entry for lock-free ring buffer
9 *
10 * Must be trivially copyable for lock-free operations.
11 * Stores only essential data; formatting happens on worker thread.
12 */
14 static constexpr size_t MAX_MESSAGE_LENGTH = 256;
15
20 const char* file_name {};
21 uint32_t line {};
22 uint32_t column {};
23 std::chrono::steady_clock::time_point timestamp;
24
25 RealtimeEntry() = default;
26
28 std::string_view msg, std::source_location loc)
29 : severity(sev)
30 , component(comp)
31 , context(ctx)
32 , file_name(loc.file_name())
33 , line(loc.line())
34 , column(loc.column())
35 , timestamp(std::chrono::steady_clock::now())
36 {
37 const size_t copy_len = std::min(msg.size(), MAX_MESSAGE_LENGTH - 1);
38 std::memcpy(message, msg.data(), copy_len);
39 message[copy_len] = '\0';
40 }
41};
42
43static_assert(std::is_trivially_copyable_v<RealtimeEntry>,
44 "RealtimeEntry must be trivially copyable");
45
46} // namespace MayaFlux::Journal
Context
Execution contexts for log messages.
static constexpr size_t MAX_MESSAGE_LENGTH
RealtimeEntry(Severity sev, Component comp, Context ctx, std::string_view msg, std::source_location loc)
char message[MAX_MESSAGE_LENGTH]
std::chrono::steady_clock::time_point timestamp
Lightweight entry for lock-free ring buffer.