mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-09 02:43:38 +08:00
feat(Logger): Implement new logger
This commit is contained in:
parent
4b8826bc43
commit
57cca88fb4
@ -15,7 +15,7 @@ namespace big
|
||||
|
||||
if (auto status = MH_CreateHook(m_target, m_detour, &m_original); status == MH_OK)
|
||||
{
|
||||
LOG(INFO_TO_FILE) << "Created hook '" << m_name << "'.";
|
||||
LOG(INFO) << "Created hook '" << m_name << "'.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -49,7 +49,7 @@ namespace big
|
||||
{
|
||||
if (auto status = MH_DisableHook(m_target); status == MH_OK)
|
||||
{
|
||||
LOG(INFO_TO_FILE) << "Disabled hook '" << m_name << "'.";
|
||||
LOG(INFO) << "Disabled hook '" << m_name << "'.";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -17,8 +17,6 @@ namespace big
|
||||
{
|
||||
window::top_bar();
|
||||
|
||||
window::log();
|
||||
|
||||
window::debug();
|
||||
|
||||
window::main();
|
||||
|
@ -1,36 +0,0 @@
|
||||
#include "gui/window.hpp"
|
||||
#include "imgui.h"
|
||||
#include "renderer.hpp"
|
||||
#include "logger.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static size_t iLastLogCount = 0;
|
||||
void window::log()
|
||||
{
|
||||
ImGui::SetNextWindowSize({ 500, 250 }, ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowPos({ 50, 50 }, ImGuiCond_FirstUseEver);
|
||||
if (g.window.log && ImGui::Begin("Log"))
|
||||
{
|
||||
ImGui::PushFont(g_renderer->m_monospace_font);
|
||||
|
||||
std::lock_guard lock(g_logger->m_mutex);
|
||||
auto msgs = g_logger->get_messages();
|
||||
|
||||
for (size_t i = 0; i < msgs.second; i++)
|
||||
{
|
||||
ImGui::TextUnformatted(msgs.first[i].get());
|
||||
}
|
||||
|
||||
if (iLastLogCount != msgs.second)
|
||||
{
|
||||
iLastLogCount = msgs.second;
|
||||
ImGui::SetScrollHereY(1.f);
|
||||
}
|
||||
|
||||
ImGui::PopFont();
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user