#include "Core/EditorConsoleSink.h" namespace XCEngine { namespace Debug { EditorConsoleSink* EditorConsoleSink::GetInstance() { static EditorConsoleSink instance; return &instance; } EditorConsoleSink::EditorConsoleSink() = default; EditorConsoleSink::~EditorConsoleSink() = default; void EditorConsoleSink::Log(const LogEntry& entry) { std::lock_guard lock(m_mutex); if (m_logs.size() >= MAX_LOGS) { m_logs.erase(m_logs.begin()); } m_logs.push_back(entry); if (m_callback) { m_callback(); } } void EditorConsoleSink::Flush() { } const std::vector& EditorConsoleSink::GetLogs() const { return m_logs; } void EditorConsoleSink::Clear() { std::lock_guard lock(m_mutex); m_logs.clear(); } void EditorConsoleSink::SetCallback(std::function callback) { m_callback = std::move(callback); } } // namespace Debug } // namespace XCEngine