Log subsystem rewritten, to handle both color and not color logs simultaneously and overall simplicity.
This commit is contained in:
parent
0a893c2172
commit
ced25c3fa0
22 changed files with 489 additions and 559 deletions
|
@ -59,11 +59,11 @@ inline static const char *asmName(xmrig::Assembly assembly, bool colors)
|
|||
static void print_memory(xmrig::Config *config) {
|
||||
# ifdef _WIN32
|
||||
if (config->isColors()) {
|
||||
xmrig::Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") "%s",
|
||||
"HUGE PAGES", Mem::isHugepagesAvailable() ? "\x1B[1;32mavailable" : "\x1B[01;31munavailable");
|
||||
}
|
||||
else {
|
||||
xmrig::Log::i()->text(" * %-13s%s", "HUGE PAGES", Mem::isHugepagesAvailable() ? "available" : "unavailable");
|
||||
xmrig::Log::print(" * %-13s%s", "HUGE PAGES", Mem::isHugepagesAvailable() ? "available" : "unavailable");
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ static void print_cpu(xmrig::Config *config)
|
|||
using namespace xmrig;
|
||||
|
||||
if (config->isColors()) {
|
||||
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%d)") " %sx64 %sAES %sAVX2",
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s (%d)") " %sx64 %sAES %sAVX2",
|
||||
"CPU",
|
||||
Cpu::info()->brand(),
|
||||
Cpu::info()->sockets(),
|
||||
|
@ -82,11 +82,11 @@ static void print_cpu(xmrig::Config *config)
|
|||
Cpu::info()->hasAES() ? "\x1B[1;32m" : "\x1B[1;31m-",
|
||||
Cpu::info()->hasAVX2() ? "\x1B[1;32m" : "\x1B[1;31m-");
|
||||
# ifndef XMRIG_NO_LIBCPUID
|
||||
Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%.1f MB/%.1f MB"), "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
|
||||
Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s%.1f MB/%.1f MB"), "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
|
||||
# endif
|
||||
}
|
||||
else {
|
||||
Log::i()->text(" * %-13s%s (%d) %sx64 %sAES %sAVX2",
|
||||
Log::print(" * %-13s%s (%d) %sx64 %sAES %sAVX2",
|
||||
"CPU",
|
||||
Cpu::info()->brand(),
|
||||
Cpu::info()->sockets(),
|
||||
|
@ -94,7 +94,7 @@ static void print_cpu(xmrig::Config *config)
|
|||
Cpu::info()->hasAES() ? "" : "-",
|
||||
Cpu::info()->hasAVX2() ? "" : "-");
|
||||
# ifndef XMRIG_NO_LIBCPUID
|
||||
Log::i()->text(" * %-13s%.1f MB/%.1f MB", "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
|
||||
Log::print(" * %-13s%.1f MB/%.1f MB", "CPU L2/L3", Cpu::info()->L2() / 1024.0, Cpu::info()->L3() / 1024.0);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ static void print_threads(xmrig::Config *config)
|
|||
snprintf(buf, sizeof buf, ", affinity=0x%" PRIX64, config->affinity());
|
||||
}
|
||||
|
||||
xmrig::Log::i()->text(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, av=%d, %sdonate=%d%%") WHITE_BOLD("%s")
|
||||
xmrig::Log::print(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, av=%d, %sdonate=%d%%") WHITE_BOLD("%s")
|
||||
: " * %-13s%d, %s, av=%d, %sdonate=%d%%%s",
|
||||
"THREADS",
|
||||
config->threadsCount(),
|
||||
|
@ -119,7 +119,7 @@ static void print_threads(xmrig::Config *config)
|
|||
buf);
|
||||
}
|
||||
else {
|
||||
xmrig::Log::i()->text(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, %sdonate=%d%%")
|
||||
xmrig::Log::print(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%d") WHITE_BOLD(", %s, %sdonate=%d%%")
|
||||
: " * %-13s%d, %s, %sdonate=%d%%",
|
||||
"THREADS",
|
||||
config->threadsCount(),
|
||||
|
@ -132,11 +132,11 @@ static void print_threads(xmrig::Config *config)
|
|||
if (config->assembly() == xmrig::ASM_AUTO) {
|
||||
const xmrig::Assembly assembly = xmrig::Cpu::info()->assembly();
|
||||
|
||||
xmrig::Log::i()->text(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13sauto:%s")
|
||||
xmrig::Log::print(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13sauto:%s")
|
||||
: " * %-13sauto:%s", "ASSEMBLY", asmName(assembly, config->isColors()));
|
||||
}
|
||||
else {
|
||||
xmrig::Log::i()->text(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s") : " * %-13s%s", "ASSEMBLY", asmName(config->assembly(), config->isColors()));
|
||||
xmrig::Log::print(config->isColors() ? GREEN_BOLD(" * ") WHITE_BOLD("%-13s%s") : " * %-13s%s", "ASSEMBLY", asmName(config->assembly(), config->isColors()));
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
@ -145,12 +145,12 @@ static void print_threads(xmrig::Config *config)
|
|||
static void print_commands(xmrig::Config *config)
|
||||
{
|
||||
if (config->isColors()) {
|
||||
xmrig::Log::i()->text(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BOLD("h") WHITE_BOLD("ashrate, ")
|
||||
xmrig::Log::print(GREEN_BOLD(" * ") WHITE_BOLD("COMMANDS ") MAGENTA_BOLD("h") WHITE_BOLD("ashrate, ")
|
||||
MAGENTA_BOLD("p") WHITE_BOLD("ause, ")
|
||||
MAGENTA_BOLD("r") WHITE_BOLD("esume"));
|
||||
}
|
||||
else {
|
||||
xmrig::Log::i()->text(" * COMMANDS 'h' hashrate, 'p' pause, 'r' resume");
|
||||
xmrig::Log::print(" * COMMANDS 'h' hashrate, 'p' pause, 'r' resume");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue