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

@ -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
View 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
View 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 */