bunch of shit clang-tidy and clion made me do

This commit is contained in:
2026-01-01 16:36:15 +01:00
parent 6f8e2e2abd
commit f871dbd2e8
9 changed files with 57 additions and 55 deletions

View File

@@ -2,7 +2,7 @@
#define LOG_HPP
// comment out to disable logging in general
#define applog(level, fmt, ...) _log(level, std::source_location::current(), fmt, ##__VA_ARGS__)
#define applog(level, fmt, ...) utils::log(level, std::source_location::current(), fmt, ##__VA_ARGS__)
// comment out to disable logging to file
// #define LOG_FILE_LOCATION "linuxSmartie.log.gz"
@@ -19,24 +19,26 @@
inline std::mutex fmtx; // file logging mutex
#endif
inline std::mutex cmtx; // console logging mutex
enum class LOG { INF, WRN, ERR, DBG, START };
constexpr std::string_view pFname(std::string_view full) {
if (auto pos = full.find(' '); pos != std::string_view::npos)
namespace utils {
inline std::mutex cmtx; // console logging mutex
constexpr std::string pFname(std::string_view full) {
if (const auto pos = full.find(' '); pos != std::string_view::npos)
full.remove_prefix(pos + 1);
if (auto pos = full.rfind('('); pos != std::string_view::npos)
if (const auto pos = full.rfind('('); pos != std::string_view::npos)
full.remove_suffix(full.size() - pos);
return full;
return std::string(full);
}
template <typename... Args>
inline void _log(LOG level, const std::source_location& loc, std::format_string<Args...> str, Args&&... args) {
void log(LOG level, const std::source_location& loc, std::format_string<Args...> str, Args&&... args) {
constexpr std::string_view reset = "\033[0m";
constexpr std::string_view pattern = "[{}{}{}] ";
std::string_view color = "";
std::string_view color;
switch (level) {
case LOG::INF:
@@ -80,6 +82,7 @@ inline void _log(LOG level, const std::source_location& loc, std::format_string<
}
#endif
}
}
#else