2021-04-20 21:46:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/core.h>
|
|
|
|
#include <fmt/color.h>
|
|
|
|
|
|
|
|
namespace hex::log {
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
void debug(const std::string &fmt, auto ... args) {
|
2021-04-20 21:46:48 +02:00
|
|
|
#if defined(DEBUG)
|
|
|
|
fmt::print(fg(fmt::color::green_yellow) | fmt::emphasis::bold, "[DEBUG] ");
|
2021-07-28 13:23:50 +02:00
|
|
|
fmt::print(fmt::runtime(fmt), args...);
|
2021-04-20 21:46:48 +02:00
|
|
|
fmt::print("\n");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
void info(const std::string &fmt, auto ... args) {
|
2021-04-20 21:46:48 +02:00
|
|
|
fmt::print(fg(fmt::color::cadet_blue) | fmt::emphasis::bold, "[INFO] ");
|
2021-07-28 13:23:50 +02:00
|
|
|
fmt::print(fmt::runtime(fmt), args...);
|
2021-04-20 21:46:48 +02:00
|
|
|
fmt::print("\n");
|
|
|
|
}
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
void warn(const std::string &fmt, auto ... args) {
|
2021-10-16 11:37:29 +02:00
|
|
|
fmt::print(fg(fmt::color::orange) | fmt::emphasis::bold, "[WARN] ");
|
2021-07-28 13:23:50 +02:00
|
|
|
fmt::print(fmt::runtime(fmt), args...);
|
2021-04-20 21:46:48 +02:00
|
|
|
fmt::print("\n");
|
|
|
|
}
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
void error(const std::string &fmt, auto ... args) {
|
2021-04-20 21:46:48 +02:00
|
|
|
fmt::print(fg(fmt::color::red) | fmt::emphasis::bold, "[ERROR] ");
|
2021-07-28 13:23:50 +02:00
|
|
|
fmt::print(fmt::runtime(fmt), args...);
|
2021-04-20 21:46:48 +02:00
|
|
|
fmt::print("\n");
|
|
|
|
}
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
void fatal(const std::string &fmt, auto ... args) {
|
2021-04-20 21:46:48 +02:00
|
|
|
fmt::print(fg(fmt::color::purple) | fmt::emphasis::bold, "[FATAL] ");
|
2021-07-28 13:23:50 +02:00
|
|
|
fmt::print(fmt::runtime(fmt), args...);
|
2021-04-20 21:46:48 +02:00
|
|
|
fmt::print("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|