diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-04-02 18:49:15 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-04-07 16:32:07 +0800 |
| commit | eff21ee2ce1fdb4328d71d801352ec25f4e457ff (patch) | |
| tree | f2b3febdbd84ca7e7b799f04a407bf408719c93e /src/log.hpp | |
| parent | 50de5f9b80f1859b6eaa3b68c10a3f1cfb994737 (diff) | |
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] <github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/log.hpp')
| -rw-r--r-- | src/log.hpp | 13 |
1 files changed, 9 insertions, 4 deletions
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 <format> #include <print> #include <string> -#include <unistd.h> 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 <typename... Args> @@ -19,7 +21,10 @@ void log(FILE *_stream, eFormatType type, std::format_string<Args...> fmt, Args if (type == TRACE) return; #endif - std::println(_stream, "{}", NFormatter::fmt(type, fmt, std::forward<Args>(args)...)); + if (g_pIOManager) + g_pIOManager->addLog({.type = type, .log = NFormatter::fmt(NONEWLINE, fmt, std::forward<Args>(args)...)}); + else + std::println(_stream, "{}", NFormatter::fmt(type, fmt, std::forward<Args>(args)...)); } inline void log(eFormatType type, std::string str) { |
