improve UI visibility of System/Logger

This commit is contained in:
2022-11-10 22:22:51 +09:00
parent e4b6e86ebf
commit 53d4f9f107
2 changed files with 24 additions and 5 deletions

View File

@@ -133,9 +133,6 @@ class Node::Lambda final : public nf7::Node::Lambda,
f_->Build().
ThenIf(self, [this, in](auto& func) mutable {
if (f_) StartThread(in, func);
}).
Catch<nf7::Exception>([log = log_](auto&) {
log->Warn("skips execution because of build failure");
});
} catch (nf7::ExpiredException&) {
}

View File

@@ -331,9 +331,31 @@ void Logger::LogView() noexcept {
}
// msg column
if (ImGui::TableNextColumn()) {
ImGui::TextUnformatted(row.msg.c_str());
auto len = row.msg.find('\n');
if (len == std::string::npos) {
len = row.msg.size();
}
const char* str = row.msg.c_str();
ImGui::TextUnformatted(str, str+len);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip(row.msg.c_str());
ImGui::BeginTooltip();
ImGui::TextUnformatted(row.msg.c_str());
if (row.ex) {
ImGui::Spacing();
ImGui::TextUnformatted("exception stack:");
for (auto ptr = row.ex; ptr;)
try {
ImGui::Bullet();
std::rethrow_exception(ptr);
} catch (Exception& e) {
ImGui::TextUnformatted(e.msg().c_str());
ptr = e.reason();
} catch (std::exception& e) {
ImGui::TextUnformatted(e.what());
ptr = nullptr;
}
}
ImGui::EndTooltip();
}
}
// path column