2021-04-20 21:46:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/core.h>
|
|
|
|
#include <fmt/color.h>
|
|
|
|
|
|
|
|
namespace hex::log {
|
|
|
|
|
|
|
|
void debug(std::string_view fmt, auto ... args) {
|
|
|
|
#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
|
|
|
|
}
|
|
|
|
|
|
|
|
void info(std::string_view fmt, auto ... args) {
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
|
|
|
void warn(std::string_view fmt, auto ... args) {
|
|
|
|
fmt::print(fg(fmt::color::light_golden_rod_yellow) | 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");
|
|
|
|
}
|
|
|
|
|
|
|
|
void error(std::string_view fmt, auto ... args) {
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
|
|
|
void fatal(std::string_view fmt, auto ... args) {
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|