diff options
| author | 2023-07-12 02:04:57 +0100 | |
|---|---|---|
| committer | 2023-07-12 02:29:04 +0100 | |
| commit | f0d817cf39987e7b7548863c86beac29440ab7c6 (patch) | |
| tree | bbf0fb853dc086d666de40f27be38f933a354f6c /src/modulemanager.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
| download | inspircd++-f0d817cf39987e7b7548863c86beac29440ab7c6.tar.gz inspircd++-f0d817cf39987e7b7548863c86beac29440ab7c6.tar.bz2 inspircd++-f0d817cf39987e7b7548863c86beac29440ab7c6.zip | |
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/modulemanager.cpp')
| -rw-r--r-- | src/modulemanager.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 2c0b27527..b0ac5f711 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -23,9 +23,8 @@ #include <filesystem> -#include <iostream> -#include <rang/rang.hpp> +#include <fmt/color.h> #include "inspircd.h" #include "dynamic.h" @@ -128,7 +127,8 @@ bool ModuleManager::Load(const std::string& modname, bool defer) /* We must load the modules AFTER initializing the socket engine, now */ void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicemap) { - std::cout << "Loading core modules " << std::flush; + fmt::print("Loading core modules "); + fflush(stdout); try { @@ -141,21 +141,24 @@ void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicem if (!InspIRCd::Match(name, "core_*" DLL_EXTENSION)) continue; - std::cout << "." << std::flush; + fmt::print("."); + fflush(stdout); this->NewServices = &servicemap[name]; if (!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); } } } catch (const std::filesystem::filesystem_error& err) { - std::cout << "failed: " << err.what() << std::endl; + fmt::println("failed: {}", err.what()); ServerInstance->Exit(EXIT_STATUS_MODULE); } - std::cout << std::endl; + fmt::println(""); } |
