From eff21ee2ce1fdb4328d71d801352ec25f4e457ff Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 2 Apr 2025 18:49:15 +0800 Subject: feat: ftxui (#17) * ready for merge rm sum random ocmments first and https://github.com/ArthurSonzogni/FTXUI/issues/1024 but still, ready for merge since we can't do anything on our end * style: clang-tidy * ci * ci * style: clang-tidy * fix * fix: scroll https://github.com/ArthurSonzogni/git-tui/blob/master/src/scroller.cpp * focus * update todo * style: clang-format * update todo * sticky scroll * update todxo * smol fix need event to update screen. so we just give event when IO updates * style: clang-format --------- Co-authored-by: github-actions[bot] --- src/log.hpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/log.hpp') diff --git a/src/log.hpp b/src/log.hpp index 996b6bc..a4654c4 100644 --- a/src/log.hpp +++ b/src/log.hpp @@ -1,16 +1,18 @@ #pragma once +#include "IOManager.hpp" #include "format.hpp" -#include #include #include -#include inline void log(FILE *_stream, eFormatType type, std::string str) { #ifndef DEBUG if (type == TRACE) return; #endif - std::println(_stream, "{}", NFormatter::fmt(type, str)); + if (g_pIOManager) + g_pIOManager->addLog({.type = type, .log = str}); + else + std::println(_stream, "{}", NFormatter::fmt(type, str)); } template @@ -19,7 +21,10 @@ void log(FILE *_stream, eFormatType type, std::format_string fmt, Args if (type == TRACE) return; #endif - std::println(_stream, "{}", NFormatter::fmt(type, fmt, std::forward(args)...)); + if (g_pIOManager) + g_pIOManager->addLog({.type = type, .log = NFormatter::fmt(NONEWLINE, fmt, std::forward(args)...)}); + else + std::println(_stream, "{}", NFormatter::fmt(type, fmt, std::forward(args)...)); } inline void log(eFormatType type, std::string str) { -- cgit v1.2.3