diff options
| author | 2023-07-12 02:04:57 +0100 | |
|---|---|---|
| committer | 2023-07-12 02:29:04 +0100 | |
| commit | f0d817cf39987e7b7548863c86beac29440ab7c6 (patch) | |
| tree | bbf0fb853dc086d666de40f27be38f933a354f6c /src/modules.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
Remove rang and use fmtlib for printing coloured messages.
This supports more platforms (e.g. Haiku) and is actually still
maintained unlike the former.
All of this code should really be cleaned up for release (maybe by
adding something like Anope's LOG_CONSOLE) but for now I've just
replaced it with the fmtlib equivalent.
Diffstat (limited to 'src/modules.cpp')
| -rw-r--r-- | src/modules.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 74d8acf08..13c73cb28 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -30,9 +30,7 @@ */ -#include <iostream> - -#include <rang/rang.hpp> +#include <fmt/color.h> #include "inspircd.h" #include "exitcodes.h" @@ -536,10 +534,12 @@ void ModuleManager::LoadAll() continue; this->NewServices = &servicemap[name]; - std::cout << "[" << rang::style::bold << rang::fg::green << "*" << rang::style::reset << "] Loading module:\t" << rang::style::bold << rang::fg::green << name << rang::style::reset << std::endl; + fmt::println("[{}] Loading module:\t{}", fmt::styled("*", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::green)), name); if (!this->Load(name, true)) { - std::cout << std::endl << "[" << rang::style::bold << rang::fg::red << "*" << rang::style::reset << "] " << this->LastError() << std::endl << std::endl; + fmt::println(""); + fmt::println("[{}] {}", fmt::styled("*", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::red)), LastError()); + fmt::println(""); ServerInstance->Exit(EXIT_STATUS_MODULE); } } @@ -558,7 +558,9 @@ void ModuleManager::LoadAll() { LastModuleError = "Unable to initialize " + modname + ": " + modexcept.GetReason(); ServerInstance->Logs.Error("MODULE", LastModuleError); - std::cout << std::endl << "[" << rang::style::bold << rang::fg::red << "*" << rang::style::reset << "] " << LastModuleError << std::endl << std::endl; + fmt::println(""); + fmt::println("[{}] {}", fmt::styled("*", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::red)), LastModuleError); + fmt::println(""); ServerInstance->Exit(EXIT_STATUS_MODULE); } } @@ -580,7 +582,9 @@ void ModuleManager::LoadAll() { LastModuleError = "Unable to read the configuration for " + modname + ": " + modexcept.GetReason(); ServerInstance->Logs.Error("MODULE", LastModuleError); - std::cout << std::endl << "[" << rang::style::bold << rang::fg::red << "*" << rang::style::reset << "] " << LastModuleError << std::endl << std::endl; + fmt::println(""); + fmt::println("[{}] {}", fmt::styled("*", fmt::emphasis::bold | fmt::fg(fmt::terminal_color::red)), LastModuleError); + fmt::println(""); ServerInstance->Exit(EXIT_STATUS_CONFIG); } } |
