2023-05-20 22:40:36 +02:00
|
|
|
#include "notify_logger_sink.h"
|
|
|
|
|
#include "imgui/imgui.h"
|
|
|
|
|
#include "imgui_notify/imgui_notify.h"
|
|
|
|
|
|
|
|
|
|
namespace satdump
|
|
|
|
|
{
|
|
|
|
|
NotifyLoggerSink::NotifyLoggerSink()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NotifyLoggerSink::~NotifyLoggerSink()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NotifyLoggerSink::receive(slog::LogMsg log)
|
|
|
|
|
{
|
2023-10-31 20:18:35 -04:00
|
|
|
if (log.lvl == slog::LOG_WARN || log.lvl == slog::LOG_ERROR)
|
|
|
|
|
{
|
|
|
|
|
notify_mutex.lock();
|
|
|
|
|
if (log.lvl == slog::LOG_WARN)
|
|
|
|
|
ImGui::InsertNotification(ImGuiToast(ImGuiToastType_Warning, "Warning", log.str.c_str()));
|
|
|
|
|
else
|
|
|
|
|
ImGui::InsertNotification(ImGuiToast(ImGuiToastType_Error, "Error", log.str.c_str()));
|
|
|
|
|
notify_mutex.unlock();
|
|
|
|
|
}
|
2023-05-20 22:40:36 +02:00
|
|
|
}
|
|
|
|
|
}
|