载入中...
搜索中...
未找到

In-engine runtime console / log ring buffer for DevTools. 更多...

#include <ConsolePanel.hpp>

Public 类型

using ImGuiDrawer = void(*)(ConsolePanel &panel)
 

Public 成员函数

 ConsolePanel (const ConsolePanel &)=delete
 
ConsolePanel & operator= (const ConsolePanel &)=delete
 
void setVisible (bool on)
 
bool isVisible () const
 
void toggleVisible ()
 
void addLog (std::string level, std::string text)
 Append a leveled log line (thread-safe).
 
void addInfo (std::string text)
 
void addWarn (std::string text)
 
void addError (std::string text)
 
void addEngineLine (const std::string &text)
 Append one line captured from process stderr under level engine.
 
bool isCapturingStderr () const
 Whether process stderr is currently mirrored into this console.
 
void clear ()
 
void setMaxEntries (size_t n)
 
std::vector< ConsoleLine > recent (size_t max=128) const
 
std::string format (size_t max=128) const
 
std::uint64_t nextSeq () const
 Sequence number the next appended line will receive.
 
std::uint64_t droppedThrough () const
 Highest sequence number no longer retained (evicted or cleared).
 
ConsoleSlice read (std::uint64_t afterSeq, size_t max=64, const std::string &level={}) const
 Read retained lines relative to a sequence cursor.
 
void attach (HSQUIRRELVM vm)
 Attach to a Squirrel VM: capture print/script errors into the log.
 
void detach ()
 
bool isAttached () const
 
std::string eval (const std::string &expression)
 Evaluate a Squirrel expression against the root table and return a formatted result (or error message). Works as a runtime REPL.
 
void drawImGui ()
 Optional ImGui draw hook. Default no-op: console UI is registered by the host (see setImGuiDrawer) so EVDevTools does not include imgui.h.
 

静态 Public 成员函数

static ConsolePanel & instance ()
 
static void setImGuiDrawer (ImGuiDrawer fn)
 

友元

template<typename >
struct Immortal
 

详细描述

In-engine runtime console / log ring buffer for DevTools.

Provides a single place for script and engine messages: leveled log lines, capture of Squirrel print / script errors, and a Squirrel REPL (expression evaluation against the root table). Mirrors the AiPanel design — thread-safe ring buffer, optional ImGui draw hook registered by the host so EVDevTools does not need to include imgui.h.

Script API (Debug builds, eve run --debug): eve.dev.console.log/info/warn/error/debug(text) eve.dev.console.eval(expr) -> result string eve.dev.console.clear() / recent(n) / format(n) / setVisible / toggleVisible

Desktop-only (part of EVDevTools); not shipped on Android/iOS trimmed runtimes.

在文件 ConsolePanel.hpp 第 58 行定义.

成员类型定义说明

◆ ImGuiDrawer

在文件 ConsolePanel.hpp 第 123 行定义.

构造及析构函数说明

◆ ConsolePanel()

eve::dev::ConsolePanel::ConsolePanel ( const ConsolePanel &  )
delete

成员函数说明

◆ addEngineLine()

void eve::dev::ConsolePanel::addEngineLine ( const std::string &  text)

Append one line captured from process stderr under level engine.

A line identical to the immediately preceding script-captured entry (print / error) is dropped: capturePrint/captureError forward to stderr, so the descriptor-level capture would otherwise duplicate every script message. Genuine consecutive engine lines are kept.

参数
textOne complete line, without its newline.

在文件 ConsolePanel.cpp 第 204 行定义.

引用了 previous , 以及 text.

被这些函数引用 attach().

◆ addError()

void eve::dev::ConsolePanel::addError ( std::string  text)

在文件 ConsolePanel.cpp 第 223 行定义.

引用了 addLog() , 以及 text.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ addInfo()

void eve::dev::ConsolePanel::addInfo ( std::string  text)

在文件 ConsolePanel.cpp 第 219 行定义.

引用了 addLog() , 以及 text.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ addLog()

void eve::dev::ConsolePanel::addLog ( std::string  level,
std::string  text 
)

Append a leveled log line (thread-safe).

在文件 ConsolePanel.cpp 第 183 行定义.

引用了 level , 以及 text.

被这些函数引用 addError(), addInfo(), addWarn(), attach(), eve::dev::DevTool::attach(), detach(), eval(), eve::dev::exposeMcpScriptApi() , 以及 eve::dev::DevTool::exposeScriptApi().

◆ addWarn()

void eve::dev::ConsolePanel::addWarn ( std::string  text)

在文件 ConsolePanel.cpp 第 221 行定义.

引用了 addLog() , 以及 text.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ attach()

void eve::dev::ConsolePanel::attach ( HSQUIRRELVM  vm)

Attach to a Squirrel VM: capture print/script errors into the log.

在文件 ConsolePanel.cpp 第 303 行定义.

引用了 eve::dev::Active, addEngineLine(), addLog(), detach(), instance(), line, eve::dev::startStderrCapture() , 以及 vm.

被这些函数引用 eve::dev::DevTool::attach().

◆ clear()

void eve::dev::ConsolePanel::clear ( )

在文件 ConsolePanel.cpp 第 225 行定义.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ detach()

void eve::dev::ConsolePanel::detach ( )

在文件 ConsolePanel.cpp 第 324 行定义.

引用了 addLog() , 以及 eve::dev::stopStderrCapture().

被这些函数引用 attach() , 以及 eve::dev::DevTool::detach().

◆ drawImGui()

void eve::dev::ConsolePanel::drawImGui ( )

Optional ImGui draw hook. Default no-op: console UI is registered by the host (see setImGuiDrawer) so EVDevTools does not include imgui.h.

在文件 ConsolePanel.cpp 第 369 行定义.

被这些函数引用 eve::dev::DevTool::drawConsolePanel().

◆ droppedThrough()

std::uint64_t eve::dev::ConsolePanel::droppedThrough ( ) const

Highest sequence number no longer retained (evicted or cleared).

在文件 ConsolePanel.cpp 第 247 行定义.

◆ eval()

std::string eve::dev::ConsolePanel::eval ( const std::string &  expression)

Evaluate a Squirrel expression against the root table and return a formatted result (or error message). Works as a runtime REPL.

在文件 ConsolePanel.cpp 第 332 行定义.

引用了 addLog(), eve::script::captureCompileError(), eve::script::ScriptCompiler::compileBuffer(), eve::script::ScriptErrorContext::empty(), eve::script::formatScriptError(), source, eve::script::takeLastScriptError(), top , 以及 vm.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ format()

std::string eve::dev::ConsolePanel::format ( size_t  max = 128) const

在文件 ConsolePanel.cpp 第 294 行定义.

引用了 lines, max , 以及 recent().

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ instance()

◆ isAttached()

bool eve::dev::ConsolePanel::isAttached ( ) const
inline

在文件 ConsolePanel.hpp 第 109 行定义.

◆ isCapturingStderr()

bool eve::dev::ConsolePanel::isCapturingStderr ( ) const

Whether process stderr is currently mirrored into this console.

在文件 ConsolePanel.cpp 第 217 行定义.

引用了 eve::dev::stderrCaptureActive().

◆ isVisible()

bool eve::dev::ConsolePanel::isVisible ( ) const

在文件 ConsolePanel.cpp 第 176 行定义.

被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 toggleVisible().

◆ nextSeq()

std::uint64_t eve::dev::ConsolePanel::nextSeq ( ) const

Sequence number the next appended line will receive.

在文件 ConsolePanel.cpp 第 242 行定义.

◆ operator=()

ConsolePanel & eve::dev::ConsolePanel::operator= ( const ConsolePanel &  )
delete

◆ read()

ConsoleSlice eve::dev::ConsolePanel::read ( std::uint64_t  afterSeq,
size_t  max = 64,
const std::string &  level = {} 
) const

Read retained lines relative to a sequence cursor.

参数
afterSeqReturn lines with seq > afterSeq; 0 selects the newest lines.
maxUpper bound on returned lines; 0 selects 64.
levelOptional exact level filter; empty keeps every level.
返回
Slice plus the cursors needed for the next incremental read. @thread Any thread; the ring buffer is mutex-guarded.

在文件 ConsolePanel.cpp 第 252 行定义.

引用了 eve::dev::ConsoleSlice::cursor, eve::dev::ConsoleSlice::droppedThrough, eve::dev::ConsoleSlice::firstSeq, level, line, eve::dev::ConsoleSlice::lines, max, eve::dev::ConsoleSlice::nextSeq , 以及 eve::dev::ConsoleSlice::truncated.

◆ recent()

std::vector< ConsoleLine > eve::dev::ConsolePanel::recent ( size_t  max = 128) const

在文件 ConsolePanel.cpp 第 285 行定义.

引用了 max , 以及 start.

被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 format().

◆ setImGuiDrawer()

void eve::dev::ConsolePanel::setImGuiDrawer ( ImGuiDrawer  fn)
static

在文件 ConsolePanel.cpp 第 367 行定义.

引用了 fn.

◆ setMaxEntries()

void eve::dev::ConsolePanel::setMaxEntries ( size_t  n)

在文件 ConsolePanel.cpp 第 233 行定义.

引用了 n.

◆ setVisible()

void eve::dev::ConsolePanel::setVisible ( bool  on)

在文件 ConsolePanel.cpp 第 171 行定义.

被这些函数引用 eve::dev::DevTool::exposeScriptApi() , 以及 toggleVisible().

◆ toggleVisible()

void eve::dev::ConsolePanel::toggleVisible ( )

在文件 ConsolePanel.cpp 第 181 行定义.

引用了 isVisible() , 以及 setVisible().

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

友元及相关函数文档

◆ Immortal

template<typename >
friend struct Immortal
friend

在文件 ConsolePanel.hpp 第 129 行定义.


该类的文档由以下文件生成: