Start logging/capturing text output to given file
| 9335 | |
| 9336 | // Start logging/capturing text output to given file |
| 9337 | void ImGui::LogToFile(int auto_open_depth, const char* filename) |
| 9338 | { |
| 9339 | ImGuiContext& g = *GImGui; |
| 9340 | if (g.LogEnabled) |
| 9341 | return; |
| 9342 | |
| 9343 | // FIXME: We could probably open the file in text mode "at", however note that clipboard/buffer logging will still |
| 9344 | // be subject to outputting OS-incompatible carriage return if within strings the user doesn't use IM_NEWLINE. |
| 9345 | // By opening the file in binary mode "ab" we have consistent output everywhere. |
| 9346 | if (!filename) |
| 9347 | filename = g.IO.LogFilename; |
| 9348 | if (!filename || !filename[0]) |
| 9349 | return; |
| 9350 | ImFileHandle f = ImFileOpen(filename, "ab"); |
| 9351 | if (!f) |
| 9352 | { |
| 9353 | IM_ASSERT(0); |
| 9354 | return; |
| 9355 | } |
| 9356 | |
| 9357 | LogBegin(ImGuiLogType_File, auto_open_depth); |
| 9358 | g.LogFile = f; |
| 9359 | } |
| 9360 | |
| 9361 | // Start logging/capturing text output to clipboard |
| 9362 | void ImGui::LogToClipboard(int auto_open_depth) |
nothing calls this directly
no test coverage detected