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