From c66fb89392f7332e6da7dfab01d8d0acfd7a9eb1 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 14 Mar 2025 11:00:38 +0800 Subject: refactor(log): removed redundant overloads --- src/log.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/log.hpp') 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 #include #include +#include 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 void log(FILE *_stream, eFormatType type, std::format_string fmt, Args &&...args) { - log(_stream, type, std::format(fmt, std::forward(args)...)); + std::println(_stream, "{}", NFormatter::fmt(type, fmt, std::forward(args)...)); +} + +inline void log(eFormatType type, std::string str) { + log(type == ERR ? stderr : stdout, type, str); } template void log(eFormatType type, std::format_string fmt, Args &&...args) { - log(stdout, type, std::format(fmt, std::forward(args)...)); + log(type == ERR ? stderr : stdout, type, fmt, std::forward(args)...); } -- cgit v1.2.3