log tweak

This commit is contained in:
2025-01-19 21:49:40 +01:00
parent 161166837f
commit fec593205b
3 changed files with 27 additions and 19 deletions

View File

@@ -526,7 +526,15 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
// Filtre de recherche
static ImGuiTextFilter filter;
filter.Draw("Filter (inc,-exc)", 180);
filter.Draw("Filter ", 180);
ImGui::SameLine();
// Bouton pour ouvrir le fichier de log
if (ImGui::Button("Open Log File"))
{
ShellExecuteA(NULL, "open", Logger::Get().m_logFilePath.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
// Place the menu on the same line as the filter
ImGui::SameLine();
@@ -548,22 +556,19 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
const auto& logBuffer = Logger::Get().GetLogBuffer();
std::vector<Logger::LogEntry> logfiltered;
int logCount = logBuffer.size();
int filteredLogCount = 0;
// Affichage des logs filtr<74>s
ImGui::BeginChild("Log");
// Compter le nombre de logs qui passent le filtre et les ajouter a la liste des message a afficher
for (const auto& log : logBuffer)
{
if (filter.PassFilter(log.message.c_str()) && !Logger::Get().m_disabledLogLevels[static_cast<size_t>(log.level)])
{
logfiltered.push_back(log);
filteredLogCount++;
}
}
if (filteredLogCount == 0)
if (logfiltered.size() == 0)
{
ImGui::Text("No logs to display.");
}
@@ -585,6 +590,12 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
clipper.End();
}
// Scroll to the bottom
if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY())
{
ImGui::SetScrollHereY(1.0f);
}
ImGui::EndChild();
ImGui::End();