mirror of
https://github.com/WerWolv/ImHex
synced 2024-10-20 09:42:24 +00:00
impr: Nicer looking logger output colors
This commit is contained in:
parent
2049852a80
commit
3c365d65a4
|
@ -49,6 +49,16 @@ namespace hex::log {
|
|||
addLogEntry(IMHEX_PROJECT_NAME, level, std::move(message));
|
||||
}
|
||||
|
||||
namespace color {
|
||||
|
||||
fmt::color debug();
|
||||
fmt::color info();
|
||||
fmt::color warn();
|
||||
fmt::color error();
|
||||
fmt::color fatal();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void suspendLogging();
|
||||
|
@ -56,26 +66,26 @@ namespace hex::log {
|
|||
|
||||
[[maybe_unused]] void debug(const std::string &fmt, auto && ... args) {
|
||||
#if defined(DEBUG)
|
||||
hex::log::impl::print(fg(fmt::color::light_green) | fmt::emphasis::bold, "[DEBUG]", fmt, args...);
|
||||
hex::log::impl::print(fg(impl::color::debug()) | fmt::emphasis::bold, "[DEBUG]", fmt, args...);
|
||||
#else
|
||||
impl::addLogEntry(IMHEX_PROJECT_NAME, "[DEBUG]", fmt::format(fmt::runtime(fmt), args...));
|
||||
#endif
|
||||
}
|
||||
|
||||
[[maybe_unused]] void info(const std::string &fmt, auto && ... args) {
|
||||
hex::log::impl::print(fg(fmt::color::cadet_blue) | fmt::emphasis::bold, "[INFO] ", fmt, args...);
|
||||
hex::log::impl::print(fg(impl::color::info()) | fmt::emphasis::bold, "[INFO] ", fmt, args...);
|
||||
}
|
||||
|
||||
[[maybe_unused]] void warn(const std::string &fmt, auto && ... args) {
|
||||
hex::log::impl::print(fg(fmt::color::orange) | fmt::emphasis::bold, "[WARN] ", fmt, args...);
|
||||
hex::log::impl::print(fg(impl::color::warn()) | fmt::emphasis::bold, "[WARN] ", fmt, args...);
|
||||
}
|
||||
|
||||
[[maybe_unused]] void error(const std::string &fmt, auto && ... args) {
|
||||
hex::log::impl::print(fg(fmt::color::red) | fmt::emphasis::bold, "[ERROR]", fmt, args...);
|
||||
hex::log::impl::print(fg(impl::color::error()) | fmt::emphasis::bold, "[ERROR]", fmt, args...);
|
||||
}
|
||||
|
||||
[[maybe_unused]] void fatal(const std::string &fmt, auto && ... args) {
|
||||
hex::log::impl::print(fg(fmt::color::purple) | fmt::emphasis::bold, "[FATAL]", fmt, args...);
|
||||
hex::log::impl::print(fg(impl::color::fatal()) | fmt::emphasis::bold, "[FATAL]", fmt, args...);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -131,6 +131,16 @@ namespace hex::log {
|
|||
}
|
||||
}
|
||||
|
||||
namespace color {
|
||||
|
||||
fmt::color debug() { return fmt::color::medium_sea_green; }
|
||||
fmt::color info() { return fmt::color::steel_blue; }
|
||||
fmt::color warn() { return fmt::color::orange; }
|
||||
fmt::color error() { return fmt::color::indian_red; }
|
||||
fmt::color fatal() { return fmt::color::medium_purple; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue