| 11140 | } |
| 11141 | |
| 11142 | bool ImGui::ErrorLog(const char* msg) |
| 11143 | { |
| 11144 | ImGuiContext& g = *GImGui; |
| 11145 | |
| 11146 | // Output to debug log |
| 11147 | #ifndef IMGUI_DISABLE_DEBUG_TOOLS |
| 11148 | ImGuiWindow* window = g.CurrentWindow; |
| 11149 | |
| 11150 | if (g.IO.ConfigErrorRecoveryEnableDebugLog) |
| 11151 | { |
| 11152 | if (g.ErrorFirst) |
| 11153 | IMGUI_DEBUG_LOG_ERROR("[imgui-error] (current settings: Assert=%d, Log=%d, Tooltip=%d)\n", |
| 11154 | g.IO.ConfigErrorRecoveryEnableAssert, g.IO.ConfigErrorRecoveryEnableDebugLog, g.IO.ConfigErrorRecoveryEnableTooltip); |
| 11155 | IMGUI_DEBUG_LOG_ERROR("[imgui-error] In window '%s': %s\n", window ? window->Name : "NULL", msg); |
| 11156 | } |
| 11157 | g.ErrorFirst = false; |
| 11158 | |
| 11159 | // Output to tooltip |
| 11160 | if (g.IO.ConfigErrorRecoveryEnableTooltip) |
| 11161 | { |
| 11162 | if (g.WithinFrameScope && BeginErrorTooltip()) |
| 11163 | { |
| 11164 | if (g.ErrorCountCurrentFrame < 20) |
| 11165 | { |
| 11166 | Text("In window '%s': %s", window ? window->Name : "NULL", msg); |
| 11167 | if (window && (!window->IsFallbackWindow || window->WasActive)) |
| 11168 | GetForegroundDrawList(window)->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 0, 0, 255)); |
| 11169 | } |
| 11170 | if (g.ErrorCountCurrentFrame == 20) |
| 11171 | Text("(and more errors)"); |
| 11172 | // EndFrame() will amend debug buttons to this window, after all errors have been submitted. |
| 11173 | EndErrorTooltip(); |
| 11174 | } |
| 11175 | g.ErrorCountCurrentFrame++; |
| 11176 | } |
| 11177 | #endif |
| 11178 | |
| 11179 | // Output to callback |
| 11180 | if (g.ErrorCallback != NULL) |
| 11181 | g.ErrorCallback(&g, g.ErrorCallbackUserData, msg); |
| 11182 | |
| 11183 | // Return whether we should assert |
| 11184 | return g.IO.ConfigErrorRecoveryEnableAssert; |
| 11185 | } |
| 11186 | |
| 11187 | // Display an error tooltip when same ID as HoveredId was submitted multiple times. |
| 11188 | // See code in ItemHoverable() for an explanation of why we associate this error to HoveredId + code drawing of rectangles over individual items instances. |
nothing calls this directly
no test coverage detected