summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/log.hpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/log.hpp b/src/log.hpp
index 5e5f1d3..8e7f0c1 100644
--- a/src/log.hpp
+++ b/src/log.hpp
@@ -3,21 +3,22 @@
#include <format>
#include <print>
#include <string>
+#include <unistd.h>
inline void log(FILE *_stream, eFormatType type, std::string str) {
std::println(_stream, "{}", NFormatter::fmt(type, str));
}
-inline void log(eFormatType type, std::string str) {
- log(stdout, type, str);
-}
-
template <typename... Args>
void log(FILE *_stream, eFormatType type, std::format_string<Args...> fmt, Args &&...args) {
- log(_stream, type, std::format(fmt, std::forward<Args>(args)...));
+ std::println(_stream, "{}", NFormatter::fmt(type, fmt, std::forward<Args>(args)...));
+}
+
+inline void log(eFormatType type, std::string str) {
+ log(type == ERR ? stderr : stdout, type, str);
}
template <typename... Args>
void log(eFormatType type, std::format_string<Args...> fmt, Args &&...args) {
- log(stdout, type, std::format(fmt, std::forward<Args>(args)...));
+ log(type == ERR ? stderr : stdout, type, fmt, std::forward<Args>(args)...);
}