MCPcopy Create free account
hub / github.com/Raais/ImStudio / LogToFile

Method LogToFile

src/third-party/imgui/imgui.cpp:11363–11385  ·  view source on GitHub ↗

Start logging/capturing text output to given file

Source from the content-addressed store, hash-verified

11361
11362// Start logging/capturing text output to given file
11363void ImGui::LogToFile(int auto_open_depth, const char* filename)
11364{
11365 ImGuiContext& g = *GImGui;
11366 if (g.LogEnabled)
11367 return;
11368
11369 // FIXME: We could probably open the file in text mode "at", however note that clipboard/buffer logging will still
11370 // be subject to outputting OS-incompatible carriage return if within strings the user doesn't use IM_NEWLINE.
11371 // By opening the file in binary mode "ab" we have consistent output everywhere.
11372 if (!filename)
11373 filename = g.IO.LogFilename;
11374 if (!filename || !filename[0])
11375 return;
11376 ImFileHandle f = ImFileOpen(filename, "ab");
11377 if (!f)
11378 {
11379 IM_ASSERT(0);
11380 return;
11381 }
11382
11383 LogBegin(ImGuiLogType_File, auto_open_depth);
11384 g.LogFile = f;
11385}
11386
11387// Start logging/capturing text output to clipboard
11388void ImGui::LogToClipboard(int auto_open_depth)

Callers

nothing calls this directly

Calls 1

ImFileOpenFunction · 0.70

Tested by

no test coverage detected