class mola::ConsoleLogSink

Overview

Thread-safe rolling store of captured log lines, bounded by entry count. Shared (shared_ptr) between MolaVizImGuiCore and the per-module logger callbacks, so it outlives any module still holding a callback.

#include <MolaVizImGuiCore.h>

class ConsoleLogSink
{
public:
    // fields

    std::atomic<size_t> max_entries {5000};
    std::atomic<double> window_seconds {120.0};

    // methods

    void push(const ConsoleLogEntry& e);
    std::deque<ConsoleLogEntry> snapshot() const;
    void clear();
    void note_source(const std::string& s);
    std::vector<std::string> sources() const;
    uint64_t version() const;
};

Methods

uint64_t version() const

Bumped on every push() /clear(). Lock-free, so callers that re-render every frame (e.g. the Console window) can skip the snapshot() /lock/copy entirely when nothing changed since their last cached copy.