mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-03 09:29:46 +00:00
Use long tags.
This commit is contained in:
parent
0ad4257113
commit
7a3233ab4b
17 changed files with 220 additions and 76 deletions
|
@ -163,8 +163,8 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
add_definitions(/D__STDC_FORMAT_MACROS)
|
||||
add_definitions(/DUNICODE)
|
||||
add_definitions(-DXMRIG_MINER_PROJECT)
|
||||
add_definitions(-D__STDC_FORMAT_MACROS -DUNICODE)
|
||||
|
||||
find_package(UV REQUIRED)
|
||||
|
||||
|
|
11
src/App.cpp
11
src/App.cpp
|
@ -32,6 +32,7 @@
|
|||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/Console.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/io/Signals.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "core/config/Config.h"
|
||||
|
@ -85,7 +86,7 @@ int xmrig::App::exec()
|
|||
Summary::print(m_controller);
|
||||
|
||||
if (m_controller->config()->isDryRun()) {
|
||||
LOG_NOTICE("OK");
|
||||
LOG_NOTICE("%s " WHITE_BOLD("OK"), Tags::config());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -102,7 +103,7 @@ int xmrig::App::exec()
|
|||
void xmrig::App::onConsoleCommand(char command)
|
||||
{
|
||||
if (command == 3) {
|
||||
LOG_WARN("Ctrl+C received, exiting");
|
||||
LOG_WARN("%s " YELLOW("Ctrl+C received, exiting"), Tags::signal());
|
||||
close();
|
||||
}
|
||||
else {
|
||||
|
@ -116,15 +117,15 @@ void xmrig::App::onSignal(int signum)
|
|||
switch (signum)
|
||||
{
|
||||
case SIGHUP:
|
||||
LOG_WARN("SIGHUP received, exiting");
|
||||
LOG_WARN("%s " YELLOW("SIGHUP received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
case SIGTERM:
|
||||
LOG_WARN("SIGTERM received, exiting");
|
||||
LOG_WARN("%s " YELLOW("SIGTERM received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
case SIGINT:
|
||||
LOG_WARN("SIGINT received, exiting");
|
||||
LOG_WARN("%s " YELLOW("SIGINT received, exiting"), Tags::signal());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
|
||||
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,8 +23,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_TAGS_H
|
||||
#define XMRIG_TAGS_H
|
||||
#ifndef XMRIG_BACKEND_TAGS_H
|
||||
#define XMRIG_BACKEND_TAGS_H
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
|
@ -35,7 +35,6 @@ namespace xmrig {
|
|||
|
||||
const char *backend_tag(uint32_t backend);
|
||||
const char *cpu_tag();
|
||||
const char *net_tag();
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
|
@ -48,7 +47,6 @@ const char *cuda_tag();
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
const char *rx_tag();
|
||||
#endif
|
||||
|
@ -57,4 +55,4 @@ const char *rx_tag();
|
|||
} // namespace xmrig
|
||||
|
||||
|
||||
#endif /* XMRIG_TAGS_H */
|
||||
#endif /* XMRIG_BACKEND_TAGS_H */
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "backend/common/Workers.h"
|
||||
#include "backend/cpu/Cpu.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "base/tools/String.h"
|
||||
|
@ -60,7 +61,6 @@ namespace xmrig {
|
|||
extern template class Threads<CpuThreads>;
|
||||
|
||||
|
||||
static const char *tag = CYAN_BG_BOLD(WHITE_BOLD_S " cpu ");
|
||||
static const String kType = "cpu";
|
||||
static std::mutex mutex;
|
||||
|
||||
|
@ -102,13 +102,13 @@ public:
|
|||
inline void print() const
|
||||
{
|
||||
if (m_started == 0) {
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), tag);
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), Tags::cpu());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("%s" GREEN_BOLD(" READY") " threads %s%zu/%zu (%zu)" CLEAR " huge pages %s%1.0f%% %zu/%zu" CLEAR " memory " CYAN_BOLD("%zu KB") BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||
tag,
|
||||
Tags::cpu(),
|
||||
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
|
||||
m_started, m_threads, m_ways,
|
||||
(m_hugePages.isFullyAllocated() ? GREEN_BOLD_S : (m_hugePages.allocated == 0 ? RED_BOLD_S : YELLOW_BOLD_S)),
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
inline void start()
|
||||
{
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
tag,
|
||||
Tags::cpu(),
|
||||
profileName.data(),
|
||||
threads.size(),
|
||||
threads.size() > 1 ? "s" : "",
|
||||
|
@ -219,13 +219,13 @@ const char *xmrig::backend_tag(uint32_t backend)
|
|||
}
|
||||
# endif
|
||||
|
||||
return tag;
|
||||
return Tags::cpu();
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::cpu_tag()
|
||||
{
|
||||
return tag;
|
||||
return Tags::cpu();
|
||||
}
|
||||
|
||||
|
||||
|
@ -279,7 +279,7 @@ void xmrig::CpuBackend::prepare(const Job &nextJob)
|
|||
if ((f == Algorithm::ARGON2) || (f == Algorithm::RANDOM_X)) {
|
||||
if (argon2::Impl::select(d_ptr->controller->config()->cpu().argon2Impl())) {
|
||||
LOG_INFO("%s use " WHITE_BOLD("argon2") " implementation " CSI "1;%dm" "%s",
|
||||
tag,
|
||||
Tags::cpu(),
|
||||
argon2::Impl::name() == "default" ? 33 : 32,
|
||||
argon2::Impl::name().data()
|
||||
);
|
||||
|
@ -344,7 +344,7 @@ void xmrig::CpuBackend::setJob(const Job &job)
|
|||
d_ptr->profileName = cpu.threads().profileName(job.algorithm());
|
||||
|
||||
if (d_ptr->profileName.isNull() || threads.empty()) {
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), tag);
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), Tags::cpu());
|
||||
|
||||
return stop();
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void xmrig::CpuBackend::stop()
|
|||
d_ptr->workers.stop();
|
||||
d_ptr->threads.clear();
|
||||
|
||||
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), tag, Chrono::steadyMSecs() - ts);
|
||||
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), Tags::cpu(), Chrono::steadyMSecs() - ts);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "backend/cuda/wrappers/CudaDevice.h"
|
||||
#include "backend/cuda/wrappers/CudaLib.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "base/tools/String.h"
|
||||
|
@ -71,7 +72,6 @@ extern template class Threads<CudaThreads>;
|
|||
|
||||
constexpr const size_t oneMiB = 1024U * 1024U;
|
||||
static const char *kLabel = "CUDA";
|
||||
static const char *tag = GREEN_BG_BOLD(WHITE_BOLD_S " nv ");
|
||||
static const String kType = "cuda";
|
||||
static std::mutex mutex;
|
||||
|
||||
|
@ -107,13 +107,13 @@ public:
|
|||
inline void print() const
|
||||
{
|
||||
if (m_started == 0) {
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), tag);
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), Tags::nvidia());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("%s" GREEN_BOLD(" READY") " threads " "%s%zu/%zu" BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||
tag,
|
||||
Tags::nvidia(),
|
||||
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
|
||||
m_started,
|
||||
m_threads,
|
||||
|
@ -208,7 +208,7 @@ public:
|
|||
inline void start(const Job &)
|
||||
{
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
tag,
|
||||
Tags::nvidia(),
|
||||
profileName.data(),
|
||||
threads.size(),
|
||||
threads.size() > 1 ? "s" : "",
|
||||
|
@ -268,7 +268,7 @@ public:
|
|||
}
|
||||
|
||||
LOG_INFO("%s" CYAN_BOLD(" #%u") YELLOW(" %s") MAGENTA_BOLD("%4uW") CSI "1;%um %2uC" CLEAR WHITE_BOLD("%s") "%s",
|
||||
tag,
|
||||
Tags::nvidia(),
|
||||
device.index(),
|
||||
device.topology().toString().data(),
|
||||
health.power,
|
||||
|
@ -299,7 +299,7 @@ public:
|
|||
|
||||
const char *xmrig::cuda_tag()
|
||||
{
|
||||
return tag;
|
||||
return Tags::nvidia();
|
||||
}
|
||||
|
||||
|
||||
|
@ -424,7 +424,7 @@ void xmrig::CudaBackend::setJob(const Job &job)
|
|||
d_ptr->profileName = cuda.threads().profileName(job.algorithm());
|
||||
|
||||
if (d_ptr->profileName.isNull() || threads.empty()) {
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), tag);
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), Tags::nvidia());
|
||||
|
||||
return stop();
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ void xmrig::CudaBackend::stop()
|
|||
d_ptr->workers.stop();
|
||||
d_ptr->threads.clear();
|
||||
|
||||
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), tag, Chrono::steadyMSecs() - ts);
|
||||
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), Tags::nvidia(), Chrono::steadyMSecs() - ts);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,11 +36,12 @@
|
|||
#include "backend/opencl/OclConfig.h"
|
||||
#include "backend/opencl/OclLaunchData.h"
|
||||
#include "backend/opencl/OclWorker.h"
|
||||
#include "backend/opencl/runners/tools/OclSharedState.h"
|
||||
#include "backend/opencl/runners/OclAstroBWTRunner.h"
|
||||
#include "backend/opencl/runners/tools/OclSharedState.h"
|
||||
#include "backend/opencl/wrappers/OclContext.h"
|
||||
#include "backend/opencl/wrappers/OclLib.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "base/tools/Chrono.h"
|
||||
#include "base/tools/String.h"
|
||||
|
@ -68,7 +69,6 @@ extern template class Threads<OclThreads>;
|
|||
|
||||
constexpr const size_t oneMiB = 1024U * 1024U;
|
||||
static const char *kLabel = "OPENCL";
|
||||
static const char *tag = MAGENTA_BG_BOLD(WHITE_BOLD_S " ocl ");
|
||||
static const String kType = "opencl";
|
||||
static std::mutex mutex;
|
||||
|
||||
|
@ -103,13 +103,13 @@ public:
|
|||
inline void print() const
|
||||
{
|
||||
if (m_started == 0) {
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), tag);
|
||||
LOG_ERR("%s " RED_BOLD("disabled") YELLOW(" (failed to start threads)"), Tags::opencl());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("%s" GREEN_BOLD(" READY") " threads " "%s%zu/%zu" BLACK_BOLD(" (%" PRIu64 " ms)"),
|
||||
tag,
|
||||
Tags::opencl(),
|
||||
m_errors == 0 ? CYAN_BOLD_S : YELLOW_BOLD_S,
|
||||
m_started,
|
||||
m_threads,
|
||||
|
@ -194,7 +194,7 @@ public:
|
|||
inline void start(const Job &job)
|
||||
{
|
||||
LOG_INFO("%s use profile " BLUE_BG(WHITE_BOLD_S " %s ") WHITE_BOLD_S " (" CYAN_BOLD("%zu") WHITE_BOLD(" thread%s)") " scratchpad " CYAN_BOLD("%zu KB"),
|
||||
tag,
|
||||
Tags::opencl(),
|
||||
profileName.data(),
|
||||
threads.size(),
|
||||
threads.size() > 1 ? "s" : "",
|
||||
|
@ -248,7 +248,7 @@ public:
|
|||
const auto health = AdlLib::health(device);
|
||||
|
||||
LOG_INFO("%s" CYAN_BOLD(" #%u") YELLOW(" %s") MAGENTA_BOLD("%4uW") CSI "1;%um %2uC" CYAN_BOLD(" %4u") CYAN("RPM") WHITE_BOLD(" %u/%u") "MHz",
|
||||
tag,
|
||||
Tags::opencl(),
|
||||
device.index(),
|
||||
device.topology().toString().data(),
|
||||
health.power,
|
||||
|
@ -280,7 +280,7 @@ public:
|
|||
|
||||
const char *xmrig::ocl_tag()
|
||||
{
|
||||
return tag;
|
||||
return Tags::opencl();
|
||||
}
|
||||
|
||||
|
||||
|
@ -405,13 +405,13 @@ void xmrig::OclBackend::setJob(const Job &job)
|
|||
d_ptr->profileName = cl.threads().profileName(job.algorithm());
|
||||
|
||||
if (d_ptr->profileName.isNull() || threads.empty()) {
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), tag);
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (no suitable configuration found)"), Tags::opencl());
|
||||
|
||||
return stop();
|
||||
}
|
||||
|
||||
if (!d_ptr->context.init(d_ptr->devices, threads)) {
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (OpenCL context unavailable)"), tag);
|
||||
LOG_WARN("%s " RED_BOLD("disabled") YELLOW(" (OpenCL context unavailable)"), Tags::opencl());
|
||||
|
||||
return stop();
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ void xmrig::OclBackend::stop()
|
|||
|
||||
OclSharedState::release();
|
||||
|
||||
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), tag, Chrono::steadyMSecs() - ts);
|
||||
LOG_INFO("%s" YELLOW(" stopped") BLACK_BOLD(" (%" PRIu64 " ms)"), Tags::opencl(), Chrono::steadyMSecs() - ts);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ set(HEADERS_BASE
|
|||
src/base/io/log/backends/FileLog.h
|
||||
src/base/io/log/FileLogWriter.h
|
||||
src/base/io/log/Log.h
|
||||
src/base/io/log/Tags.h
|
||||
src/base/io/Signals.h
|
||||
src/base/io/Watcher.h
|
||||
src/base/kernel/Base.h
|
||||
|
@ -81,6 +82,7 @@ set(SOURCES_BASE
|
|||
src/base/io/log/backends/FileLog.cpp
|
||||
src/base/io/log/FileLogWriter.cpp
|
||||
src/base/io/log/Log.cpp
|
||||
src/base/io/log/Tags.cpp
|
||||
src/base/io/Signals.cpp
|
||||
src/base/io/Watcher.cpp
|
||||
src/base/kernel/Base.cpp
|
||||
|
|
|
@ -142,8 +142,11 @@ private:
|
|||
#define LOG_NOTICE(x, ...) xmrig::Log::print(xmrig::Log::NOTICE, x, ##__VA_ARGS__)
|
||||
#define LOG_INFO(x, ...) xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__)
|
||||
#define LOG_VERBOSE(x, ...) if (xmrig::Log::verbose() > 0) { xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__); }
|
||||
#define LOG_V(x, ...) if (xmrig::Log::verbose() > 0) { xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__); }
|
||||
#define LOG_VV(x, ...) if (xmrig::Log::verbose() > 1) { xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__); }
|
||||
#define LOG_V1(x, ...) if (xmrig::Log::verbose() > 0) { xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__); }
|
||||
#define LOG_V2(x, ...) if (xmrig::Log::verbose() > 1) { xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__); }
|
||||
#define LOG_V3(x, ...) if (xmrig::Log::verbose() > 2) { xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__); }
|
||||
#define LOG_V4(x, ...) if (xmrig::Log::verbose() > 3) { xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__); }
|
||||
#define LOG_V5(x, ...) if (xmrig::Log::verbose() > 4) { xmrig::Log::print(xmrig::Log::INFO, x, ##__VA_ARGS__); }
|
||||
|
||||
#ifdef APP_DEBUG
|
||||
# define LOG_DEBUG(x, ...) xmrig::Log::print(xmrig::Log::DEBUG, x, ##__VA_ARGS__)
|
||||
|
|
93
src/base/io/log/Tags.cpp
Normal file
93
src/base/io/log/Tags.cpp
Normal file
|
@ -0,0 +1,93 @@
|
|||
/* XMRig
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/io/log/Log.h"
|
||||
|
||||
|
||||
const char *xmrig::Tags::config()
|
||||
{
|
||||
static const char *tag = CYAN_BG_BOLD(WHITE_BOLD_S " config ");
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::Tags::network()
|
||||
{
|
||||
static const char *tag = BLUE_BG_BOLD(WHITE_BOLD_S " net ");
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::Tags::signal()
|
||||
{
|
||||
static const char *tag = YELLOW_BG_BOLD(WHITE_BOLD_S " signal ");
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_MINER_PROJECT
|
||||
const char *xmrig::Tags::cpu()
|
||||
{
|
||||
static const char *tag = CYAN_BG_BOLD(WHITE_BOLD_S " cpu ");
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
const char *xmrig::Tags::miner()
|
||||
{
|
||||
static const char *tag = MAGENTA_BG_BOLD(WHITE_BOLD_S " miner ");
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
#ifdef XMRIG_ALGO_RANDOMX
|
||||
const char *xmrig::Tags::randomx()
|
||||
{
|
||||
static const char *tag = BLUE_BG(WHITE_BOLD_S " randomx ") " ";
|
||||
|
||||
return tag;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_CUDA
|
||||
const char *xmrig::Tags::nvidia()
|
||||
{
|
||||
static const char *tag = GREEN_BG_BOLD(WHITE_BOLD_S " nvidia ");
|
||||
|
||||
return tag;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XMRIG_FEATURE_OPENCL
|
||||
const char *xmrig::Tags::opencl()
|
||||
{
|
||||
static const char *tag = MAGENTA_BG_BOLD(WHITE_BOLD_S " opencl ");
|
||||
|
||||
return tag;
|
||||
}
|
||||
#endif
|
58
src/base/io/log/Tags.h
Normal file
58
src/base/io/log/Tags.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* XMRig
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef XMRIG_TAGS_H
|
||||
#define XMRIG_TAGS_H
|
||||
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
class Tags
|
||||
{
|
||||
public:
|
||||
static const char *config();
|
||||
static const char *network();
|
||||
static const char *signal();
|
||||
|
||||
# ifdef XMRIG_MINER_PROJECT
|
||||
static const char *cpu();
|
||||
static const char *miner();
|
||||
# ifdef XMRIG_ALGO_RANDOMX
|
||||
static const char *randomx();
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_CUDA
|
||||
static const char *nvidia();
|
||||
# endif
|
||||
|
||||
# ifdef XMRIG_FEATURE_OPENCL
|
||||
static const char *opencl();
|
||||
# endif
|
||||
};
|
||||
|
||||
|
||||
} /* namespace xmrig */
|
||||
|
||||
|
||||
#endif /* XMRIG_TAGS_H */
|
|
@ -33,6 +33,7 @@
|
|||
#include "base/io/log/backends/ConsoleLog.h"
|
||||
#include "base/io/log/backends/FileLog.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/io/Watcher.h"
|
||||
#include "base/kernel/interfaces/IBaseListener.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
|
@ -285,7 +286,7 @@ void xmrig::Base::addListener(IBaseListener *listener)
|
|||
|
||||
void xmrig::Base::onFileChanged(const String &fileName)
|
||||
{
|
||||
LOG_WARN("\"%s\" was changed, reloading configuration", fileName.data());
|
||||
LOG_WARN("%s " YELLOW("\"%s\" was changed, reloading configuration"), Tags::config(), fileName.data());
|
||||
|
||||
JsonChain chain;
|
||||
chain.addFile(fileName);
|
||||
|
@ -293,7 +294,7 @@ void xmrig::Base::onFileChanged(const String &fileName)
|
|||
auto config = new Config();
|
||||
|
||||
if (!config->read(chain, chain.fileName())) {
|
||||
LOG_ERR("reloading failed");
|
||||
LOG_ERR("%s " RED("reloading failed"), Tags::config());
|
||||
|
||||
delete config;
|
||||
return;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "base/io/json/Json.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/kernel/interfaces/IJsonReader.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -122,7 +123,7 @@ bool xmrig::BaseConfig::save()
|
|||
getJSON(doc);
|
||||
|
||||
if (Json::save(m_fileName, doc)) {
|
||||
LOG_NOTICE("configuration saved to: \"%s\"", m_fileName.data());
|
||||
LOG_NOTICE("%s " WHITE_BOLD("configuration saved to: \"%s\""), Tags::config(), m_fileName.data());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "backend/cpu/Cpu.h"
|
||||
#include "backend/cpu/CpuBackend.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/kernel/Platform.h"
|
||||
#include "base/net/stratum/Job.h"
|
||||
#include "base/tools/Object.h"
|
||||
|
@ -258,7 +259,8 @@ public:
|
|||
backend->printHashrate(details);
|
||||
}
|
||||
|
||||
LOG_INFO(WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("H/s") " max " CYAN_BOLD("%s H/s"),
|
||||
LOG_INFO("%s " WHITE_BOLD("speed") " 10s/60s/15m " CYAN_BOLD("%s") CYAN(" %s %s ") CYAN_BOLD("H/s") " max " CYAN_BOLD("%s H/s"),
|
||||
Tags::miner(),
|
||||
Hashrate::format(speed[0], num, sizeof(num) / 4),
|
||||
Hashrate::format(speed[1], num + 16, sizeof(num) / 4),
|
||||
Hashrate::format(speed[2], num + 16 * 2, sizeof(num) / 4 ),
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
* Copyright 2017-2019 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
|
||||
* Copyright 2018 Lee Clagett <https://github.com/vtnerd>
|
||||
* Copyright 2018-2019 tevador <tevador@gmail.com>
|
||||
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include "backend/common/Tags.h"
|
||||
#include "backend/cpu/CpuConfig.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "crypto/rx/RxConfig.h"
|
||||
#include "crypto/rx/RxQueue.h"
|
||||
|
||||
|
@ -41,7 +42,6 @@ class RxPrivate;
|
|||
|
||||
static bool osInitialized = false;
|
||||
static bool msrInitialized = false;
|
||||
static const char *tag = BLUE_BG(WHITE_BOLD_S " rx ") " ";
|
||||
static RxPrivate *d_ptr = nullptr;
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
|||
|
||||
const char *xmrig::rx_tag()
|
||||
{
|
||||
return tag;
|
||||
return Tags::randomx();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "3rdparty/rapidjson/document.h"
|
||||
#include "backend/common/Tags.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/io/log/Tags.h"
|
||||
#include "base/net/stratum/Client.h"
|
||||
#include "base/net/stratum/NetworkState.h"
|
||||
#include "base/net/stratum/SubmitResult.h"
|
||||
|
@ -57,22 +58,6 @@
|
|||
#include <memory>
|
||||
|
||||
|
||||
namespace xmrig {
|
||||
|
||||
|
||||
static const char *tag = BLUE_BG_BOLD(WHITE_BOLD_S " net ");
|
||||
|
||||
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
|
||||
const char *xmrig::net_tag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
xmrig::Network::Network(Controller *controller) :
|
||||
m_controller(controller)
|
||||
{
|
||||
|
@ -116,17 +101,17 @@ void xmrig::Network::connect()
|
|||
void xmrig::Network::onActive(IStrategy *strategy, IClient *client)
|
||||
{
|
||||
if (m_donate && m_donate == strategy) {
|
||||
LOG_NOTICE("%s " WHITE_BOLD("dev donate started"), tag);
|
||||
LOG_NOTICE("%s " WHITE_BOLD("dev donate started"), Tags::network());
|
||||
return;
|
||||
}
|
||||
|
||||
const char *tlsVersion = client->tlsVersion();
|
||||
LOG_INFO("%s " WHITE_BOLD("use %s ") CYAN_BOLD("%s:%d ") GREEN_BOLD("%s") " " BLACK_BOLD("%s"),
|
||||
tag, client->mode(), client->pool().host().data(), client->pool().port(), tlsVersion ? tlsVersion : "", client->ip().data());
|
||||
Tags::network(), client->mode(), client->pool().host().data(), client->pool().port(), tlsVersion ? tlsVersion : "", client->ip().data());
|
||||
|
||||
const char *fingerprint = client->tlsFingerprint();
|
||||
if (fingerprint != nullptr) {
|
||||
LOG_INFO("%s " BLACK_BOLD("fingerprint (SHA-256): \"%s\""), tag, fingerprint);
|
||||
LOG_INFO("%s " BLACK_BOLD("fingerprint (SHA-256): \"%s\""), Tags::network(), fingerprint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,12 +180,12 @@ void xmrig::Network::onLogin(IStrategy *, IClient *client, rapidjson::Document &
|
|||
void xmrig::Network::onPause(IStrategy *strategy)
|
||||
{
|
||||
if (m_donate && m_donate == strategy) {
|
||||
LOG_NOTICE("%s " WHITE_BOLD("dev donate finished"), tag);
|
||||
LOG_NOTICE("%s " WHITE_BOLD("dev donate finished"), Tags::network());
|
||||
m_strategy->resume();
|
||||
}
|
||||
|
||||
if (!m_strategy->isActive()) {
|
||||
LOG_ERR("%s " RED("no active pools, stop mining"), tag);
|
||||
LOG_ERR("%s " RED("no active pools, stop mining"), Tags::network());
|
||||
|
||||
return m_controller->miner()->pause();
|
||||
}
|
||||
|
@ -247,11 +232,11 @@ void xmrig::Network::setJob(IClient *client, const Job &job, bool donate)
|
|||
{
|
||||
if (job.height()) {
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s") " height " WHITE_BOLD("%" PRIu64),
|
||||
tag, client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName(), job.height());
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName(), job.height());
|
||||
}
|
||||
else {
|
||||
LOG_INFO("%s " MAGENTA_BOLD("new job") " from " WHITE_BOLD("%s:%d") " diff " WHITE_BOLD("%" PRIu64) " algo " WHITE_BOLD("%s"),
|
||||
tag, client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName());
|
||||
Tags::network(), client->pool().host().data(), client->pool().port(), job.diff(), job.algorithm().shortName());
|
||||
}
|
||||
|
||||
if (!donate && m_donate) {
|
||||
|
|
Loading…
Reference in a new issue