26 ltStop_ = std::move(stopHandler);
51 if (t.flagPtr && *t.flagPtr && t.onTick)
101 ImGui::SetNextWindowSize(ImVec2(980, 560), ImGuiCond_FirstUseEver);
102 ImGui::SetNextWindowBgAlpha(1.0f);
103 if (ImGui::Begin(
"Console", &
visible_, ImGuiWindowFlags_NoCollapse))
105 float leftWidth = 320.0f;
107 ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.12f, 0.12f, 0.14f, 1.0f));
108 ImGui::BeginChild(
"LeftPanel", ImVec2(leftWidth, 0),
true);
111 ImGui::PopStyleColor();
115 ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.10f, 0.10f, 0.12f, 1.0f));
116 ImGui::BeginChild(
"RightPanel", ImVec2(0, 0),
true);
119 ImGui::PopStyleColor();
127 std::vector<std::string>& order)
131 auto has = [&](
const std::string& name)
133 return std::find(chans.begin(), chans.end(), name) != chans.end();
140 display.push_back(
"Main");
141 order.push_back(
"main");
143 if (has(
"localtunnel"))
145 display.push_back(
"LocalTunnel");
146 order.push_back(
"localtunnel");
149 for (
auto& c : chans)
151 if (c !=
"main" && c !=
"localtunnel")
153 display.push_back(c);
159 display.push_back(
"Main");
160 order.push_back(
"main");
166 ImGui::TextUnformatted(
"Console Select");
184 bool selected = (i == sel);
192 ImGui::SetItemDefaultFocus();
197 if (ImGui::Button(
"Clear Console"))
202 ImGui::Dummy(ImVec2(0, 6));
204 ImGui::TextUnformatted(
"LocalTunnel");
205 if (ImGui::Button(
"Start"))
221 if (ImGui::Button(
"Stop"))
234 ImGui::Dummy(ImVec2(0, 6));
237 if (ImGui::Button(
"Print Identity"))
250 ImGui::Dummy(ImVec2(0, 6));
254 ImGui::SetItemTooltip(
"When ON, the per-frame debug callbacks of active toggles will run.");
256 ImGui::TextUnformatted(
"Debug Toggles");
257 ImGui::BeginChild(
"TogglesScroll", ImVec2(0, -30),
false, ImGuiWindowFlags_HorizontalScrollbar);
260 bool val = t.flagPtr ? *t.flagPtr :
false;
261 if (ImGui::Checkbox(t.label.c_str(), &val))
276 static bool showTimestamps =
true;
277 ImGui::Checkbox(
"Timestamps", &showTimestamps);
283 ImGui::BeginChild(
"LogScroll", ImVec2(0, 0),
false, ImGuiWindowFlags_HorizontalScrollbar);
284 for (
auto& e : entries)
293 ImGui::TextWrapped(
"%s", e.text.c_str());
294 ImGui::PopStyleColor();
298 ImGui::TextColored(col,
"%s", e.text.c_str());
301 if (
autoScroll_ && ImGui::GetScrollY() >= ImGui::GetScrollMaxY() - 5.0f)
302 ImGui::SetScrollHereY(1.0f);
311 return ImVec4(0.65f, 0.65f, 0.65f, 1.0f);
313 return ImVec4(0.85f, 0.85f, 0.85f, 1.0f);
315 return ImVec4(0.60f, 0.80f, 1.00f, 1.0f);
317 return ImVec4(1.00f, 0.85f, 0.40f, 1.0f);
319 return ImVec4(0.45f, 0.95f, 0.55f, 1.0f);
321 return ImVec4(1.00f, 0.45f, 0.45f, 1.0f);
323 return ImVec4(0.85f, 0.85f, 0.85f, 1.0f);
331 inline static std::function<std::string()>
ltStart_;
static void setLocalTunnelHandlers(std::function< std::string()> startHandler, std::function< void()> stopHandler)
static void bootstrapStdCapture()
static std::vector< std::string > displayNames_
static const std::string & activeChannel()
static void buildChannelLists_(std::vector< std::string > &display, std::vector< std::string > &order)
static std::string activeChannel_
static std::vector< DebugToggle > toggles_
static std::function< std::string()> ltStart_
static ImVec4 colorForLevel_(Logger::Level lvl)
static std::function< void()> ltStop_
static std::vector< std::string > channelOrder_
static void renderLeftPanel_()
static void addToggle(const DebugToggle &t)
static void renderRightPanel_()
static bool debugExecEnabled_
static void setVisible(bool v)
static std::function< std::string()> identityLogger_
static void RunActiveDebugToggles()
static void setActiveChannel(const std::string &ch)
static void setIdentityLogger(std::function< std::string()> identityLogger)
static bool isDebugExecEnabled()
static void setDebugExecEnabled(bool v)
static void clearToggles()
std::vector< LogEntry > getChannel(const std::string &channel)
static std::string formatTs(uint64_t ms)
std::vector< std::string > channels() const
void log(const std::string &channel, const std::string &line)
static Logger & instance()
void clearChannel(const std::string &channel)
std::function< void(bool enabled)> onChanged
std::function< void()> onTick