diff options
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) { |
