REDACTED-rig/src/cc/Summary.cpp
Ben Gräf de9f64e515
Server improvements and remote machine reboot (#213)
* Add remote reboot feature to Dashboard, Server & Miner
* Integrated Pushover push notifications for Offline miners and periodical stats
2018-11-28 08:59:44 +01:00

95 lines
3 KiB
C++

/* XMRig
* Copyright 2010 Jeff Garzik <jgarzik@pobox.com>
* Copyright 2012-2014 pooler <pooler@litecoinpool.org>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2016-2017 XMRig <support@xmrig.com>
* Copyright 2017- BenDr0id <ben@graef.in>
*
*
* 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 <string>
#include <uv.h>
#include "log/Log.h"
#include "Options.h"
#include "Summary.h"
#include "version.h"
static void print_versions()
{
char buf[16];
# if defined(__clang__)
snprintf(buf, 16, " clang/%d.%d.%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
# elif defined(__GNUC__)
snprintf(buf, 16, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
# elif defined(_MSC_VER)
snprintf(buf, 16, " MSVC/%d", MSVC_VERSION);
# else
buf[0] = '\0';
# endif
Log::i()->text(Options::i()->colors() ? "\x1B[01;32m * \x1B[01;37mVERSIONS: \x1B[01;36m%s/%s\x1B[01;37m libuv/%s%s \x1B[01;36m(%s)" : " * VERSIONS: %s/%s libuv/%s%s (%s)",
APP_NAME, APP_VERSION, uv_version_string(), buf, BUILD_TYPE);
}
static void print_commands()
{
if (Options::i()->colors()) {
Log::i()->text("\x1B[01;32m * \x1B[01;37mCOMMANDS: \x1B[01;35mq\x1B[01;37muit");
}
else {
Log::i()->text(" * COMMANDS: 'q' Quit");
}
}
void Summary::print_pushinfo() {
if (Options::i()->ccPushoverToken() && Options::i()->ccPushoverUser())
{
#ifndef XMRIG_NO_TLS
if (Options::i()->colors()) {
Log::i()->text("\x1B[01;32m * \x1B[01;37mPUSHSERVICE: \x1B[01;32mEnabled");
}
else {
Log::i()->text(" * PUSHSERVICE: Enabled");
}
#else
if (Options::i()->colors()) {
Log::i()->text("\x1B[01;32m * \x1B[01;37mPUSHSERVICE: \x1B[01;31mUnavailable requires TLS");
}
else {
Log::i()->text(" * PUSHSERVICE: Unavailable requires TLS");
}
#endif
} else {
if (Options::i()->colors()) {
Log::i()->text("\x1B[01;32m * \x1B[01;37mPUSHSERVICE: \x1B[01;31mDisabled");
}
else {
Log::i()->text(" * PUSHSERVICE: Disabled");
}
}
}
void Summary::print()
{
print_versions();
print_pushinfo();
print_commands();
}