Browse Source

Add minelog, a verbosity 1 logger for ethminer

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
6c0e682ffc
  1. 20
      ethminer/MinerAux.h

20
ethminer/MinerAux.h

@ -81,6 +81,12 @@ inline std::string credits()
} }
class BadArgument: public Exception {}; class BadArgument: public Exception {};
struct MiningChannel: public LogChannel
{
static const char* name() { return EthGreen "miner"; }
static const int verbosity = 2;
};
#define minelog clog(MiningChannel)
class MinerCLI class MinerCLI
{ {
@ -484,14 +490,14 @@ private:
for (unsigned i = 0; !completed; ++i) for (unsigned i = 0; !completed; ++i)
{ {
if (current) if (current)
cnote << "Mining on PoWhash" << current.headerHash << ": " << f.miningProgress(); minelog << "Mining on PoWhash" << current.headerHash << ": " << f.miningProgress();
else else
cnote << "Getting work package..."; minelog << "Getting work package...";
Json::Value v = rpc.eth_getWork(); Json::Value v = rpc.eth_getWork();
h256 hh(v[0].asString()); h256 hh(v[0].asString());
h256 newSeedHash(v[1].asString()); h256 newSeedHash(v[1].asString());
if (current.seedHash != newSeedHash) if (current.seedHash != newSeedHash)
cnote << "Grabbing DAG for" << newSeedHash; minelog << "Grabbing DAG for" << newSeedHash;
if (!(dag = EthashAux::full(newSeedHash, true, [&](unsigned _pc){ cout << "\rCreating DAG. " << _pc << "% done..." << flush; return 0; }))) if (!(dag = EthashAux::full(newSeedHash, true, [&](unsigned _pc){ cout << "\rCreating DAG. " << _pc << "% done..." << flush; return 0; })))
BOOST_THROW_EXCEPTION(DAGCreationFailure()); BOOST_THROW_EXCEPTION(DAGCreationFailure());
if (m_precompute) if (m_precompute)
@ -501,10 +507,10 @@ private:
current.headerHash = hh; current.headerHash = hh;
current.seedHash = newSeedHash; current.seedHash = newSeedHash;
current.boundary = h256(fromHex(v[2].asString()), h256::AlignRight); current.boundary = h256(fromHex(v[2].asString()), h256::AlignRight);
cnote << "Got work package:"; minelog << "Got work package:";
cnote << " Header-hash:" << current.headerHash.hex(); minelog << " Header-hash:" << current.headerHash.hex();
cnote << " Seedhash:" << current.seedHash.hex(); minelog << " Seedhash:" << current.seedHash.hex();
cnote << " Target: " << h256(current.boundary).hex(); minelog << " Target: " << h256(current.boundary).hex();
f.setWork(current); f.setWork(current);
} }
this_thread::sleep_for(chrono::milliseconds(_recheckPeriod)); this_thread::sleep_for(chrono::milliseconds(_recheckPeriod));

Loading…
Cancel
Save