Use long tags.

This commit is contained in:
XMRig 2020-05-28 20:32:41 +07:00
parent 0ad4257113
commit 7a3233ab4b
No known key found for this signature in database
GPG key ID: 446A53638BE94409
17 changed files with 220 additions and 76 deletions

View file

@ -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) {