@@ -17560,14 +17560,23 @@ void ImGui::DebugLogV(const char* fmt, va_list args)
1756017560 g.DebugLogBuf.appendf("[%05d] ", g.FrameCount);
1756117561 g.DebugLogBuf.appendfv(fmt, args);
1756217562 g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size());
17563+
17564+ const char* str = g.DebugLogBuf.begin() + old_size;
1756317565 if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY)
17564- IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size);
17566+ IMGUI_DEBUG_PRINTF("%s", str);
17567+ #if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS)
17568+ if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToDebugger)
17569+ {
17570+ ::OutputDebugStringA("[imgui] ");
17571+ ::OutputDebugStringA(str);
17572+ }
17573+ #endif
1756517574#ifdef IMGUI_ENABLE_TEST_ENGINE
1756617575 // IMGUI_TEST_ENGINE_LOG() adds a trailing \n automatically
1756717576 const int new_size = g.DebugLogBuf.size();
1756817577 const bool trailing_carriage_return = (g.DebugLogBuf[new_size - 1] == '\n');
1756917578 if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTestEngine)
17570- IMGUI_TEST_ENGINE_LOG("%.*s", new_size - old_size - (trailing_carriage_return ? 1 : 0), g.DebugLogBuf.begin() + old_size );
17579+ IMGUI_TEST_ENGINE_LOG("%.*s", new_size - old_size - (trailing_carriage_return ? 1 : 0), str );
1757117580#endif
1757217581}
1757317582
@@ -17647,6 +17656,7 @@ void ImGui::ShowDebugLogWindow(bool* p_open)
1764717656 if (BeginPopup("Outputs"))
1764817657 {
1764917658 CheckboxFlags("OutputToTTY", &g.DebugLogFlags, ImGuiDebugLogFlags_OutputToTTY);
17659+ CheckboxFlags("OutputToDebugger", &g.DebugLogFlags, ImGuiDebugLogFlags_OutputToDebugger);
1765017660#ifndef IMGUI_ENABLE_TEST_ENGINE
1765117661 BeginDisabled();
1765217662#endif
0 commit comments