From 6f7b994684032060f0a2d7af82f4f3572293b8d6 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 12 Jun 2025 21:41:41 +0800 Subject: internal!: organized internal structure, using cmake now --- src/format.hpp | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/format.hpp (limited to 'src/format.hpp') diff --git a/src/format.hpp b/src/format.hpp deleted file mode 100644 index f857f96..0000000 --- a/src/format.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once -#include -#include - -enum eFormatType : int8_t { - NONE, - TRACE, - LOG, - WARN, - ERR, - SYS, - NONEWLINE -}; - -namespace NFormatter { -inline std::string fmt(eFormatType type, std::string str) { - std::string prefix; - switch (type) { - case LOG: - prefix = "[LOG] "; - break; - case WARN: - prefix = "[WARN] "; - break; - case ERR: - prefix = "[ERROR] "; - break; - case SYS: - prefix = "[SYSTEM] "; - break; -#ifdef DEBUG - case TRACE: - prefix = "[DEBUG] "; - break; -#endif - default: - prefix = ""; - break; - } - - if (!str.empty() && str.back() != '\n' && type != NONEWLINE) - str += '\n'; - - return prefix + str; -} - -template -std::string fmt(eFormatType type, std::format_string fmt, Args &&...args) { - return NFormatter::fmt(type, std::format(fmt, std::forward(args)...)); -} -} // namespace NFormatter -- cgit v1.2.3