Skip to content

EntropyEngine::Core::Logging::LogEntry

A single log entry containing all metadata and message. More…

#include <LogEntry.h>

Name
LogEntry(LogLevel lvl, std::string_view cat, std::string msg, const std::source_location & loc =std::source_location::current())
Construct a log entry with current timestamp and thread ID.
Name
std::chrono::system_clock::time_pointtimestamp
Timestamp when the log was created.
std::thread::idthreadId
Thread ID that created the log.
std::stringmessage
The actual log message.
std::source_locationlocation
Source location information (file:line).
LogLevellevel
Log severity level.
void *context
Optional: Thread-local context (e.g., current work item).
std::string_viewcategory
Category/module name (e.g., “WorkGraph”, “Renderer”).
struct EntropyEngine::Core::Logging::LogEntry;

A single log entry containing all metadata and message.

LogEntry captures comprehensive information about each log event including the message content, timestamp, source location, thread ID, severity level, and category. This provides complete context for debugging and analysis.

Design principles:

  • Complete: Contains all necessary debugging context
  • Flexible: Sinks determine final formatting and presentation
  • Thread-safe: Safe to pass between threads

Formatting is deferred to sinks. The entry captures raw data, allowing background threads to handle formatting operations.

inline LogEntry(
LogLevel lvl,
std::string_view cat,
std::string msg,
const std::source_location & loc =std::source_location::current()
)

Construct a log entry with current timestamp and thread ID.

Parameters:

  • lvl Log severity level
  • cat Category/subsystem name
  • msg Log message content
  • loc Source location (captured automatically)

Automatically captures time, thread ID, and source location using C++20 source_location.

// Location is captured automatically at the call site
LogEntry entry(LogLevel::Error, "Database", "Connection failed");
// entry.location contains the file:line information
std::chrono::system_clock::time_point timestamp;

Timestamp when the log was created.

std::thread::id threadId;

Thread ID that created the log.

std::string message;

The actual log message.

std::source_location location;

Source location information (file:line).

LogLevel level;

Log severity level.

void * context = nullptr;

Optional: Thread-local context (e.g., current work item).

std::string_view category;

Category/module name (e.g., “WorkGraph”, “Renderer”).


Updated on 2026-01-26 at 17:14:35 -0500