virtual void run () { while (!isDone()) { std::ostringstream oss; oss.width(8); oss << getLogCount() << "\b\b\b\b\b\b\b\b"; std::cout << oss.str() << std::flush; sleep(1); } }
Handle<Value> LogJs::log(const Arguments& args, Log::WarningLevel level) { HandleScope scope; Context::Scope context_scope(Context::GetCurrent()); if (level >= Log::getInstance().getLevel()) { Local<StackTrace> stack = StackTrace::CurrentStackTrace(1); Local<StackFrame> frame = stack->GetFrame(0); int lineNumber = -1; QString script("<unknown>"); QString functionName("<unknown>"); if (stack->GetFrameCount() >= 1) { lineNumber = frame->GetLineNumber(); script = toString(frame->GetScriptName()); functionName = toString(frame->GetFunctionName()); } std::stringstream rMessage; for (int i = 0; i < args.Length(); i++) { if (i != 0) { rMessage << " "; } rMessage << args[i]; } QString message = QString::fromUtf8(rMessage.str().data()); int logLimit = ConfigOptions().getOgrLogLimit(); int messageCount = getLogCount(message); if (messageCount == logLimit) { message = QString("Received %1 of the same message. Silencing: ").arg(messageCount) + message; } if (messageCount <= logLimit) { Log::getInstance().log(level, message, script, functionName, lineNumber); } } return scope.Close(Undefined()); }
/** * Get the number of backtracks (unlucky guesses) required * when solving this puzzle. */ int BoardGenerator::getBacktrackCount(){ return getLogCount(solveHistory, LogItem::ROLLBACK); }
/** * Get the number of box/line reductions that were performed * in solving this puzzle. */ int BoardGenerator::getBoxLineReductionCount(){ return getLogCount(solveInstructions, LogItem::ROW_BOX)+ getLogCount(solveInstructions, LogItem::COLUMN_BOX); }
/** * Get the number lucky guesses in solving this puzzle. */ int BoardGenerator::getGuessCount(){ return getLogCount(solveInstructions, LogItem::GUESS); }
/** * Get the number of pointing pair/triple reductions that were performed * in solving this puzzle. */ int BoardGenerator::getPointingPairTripleCount(){ return getLogCount(solveInstructions, LogItem::POINTING_PAIR_TRIPLE_ROW)+ getLogCount(solveInstructions, LogItem::POINTING_PAIR_TRIPLE_COLUMN); }
/** * Get the number of hidden pair reductions that were performed * in solving this puzzle. */ int BoardGenerator::getHiddenPairCount(){ return getLogCount(solveInstructions, LogItem::HIDDEN_PAIR_ROW) + getLogCount(solveInstructions, LogItem::HIDDEN_PAIR_COLUMN) + getLogCount(solveInstructions, LogItem::HIDDEN_PAIR_SECTION); }
/** * Get the number of naked pair reductions that were performed * in solving this puzzle. */ int BoardGenerator::getNakedPairCount(){ return getLogCount(solveInstructions, LogItem::NAKED_PAIR_ROW) + getLogCount(solveInstructions, LogItem::NAKED_PAIR_COLUMN) + getLogCount(solveInstructions, LogItem::NAKED_PAIR_SECTION); }
/** * Get the number of cells for which the solution was determined * because that cell had the only possibility for some value in * the row, column, or section. */ int BoardGenerator::getHiddenSingleCount(){ return getLogCount(solveInstructions, LogItem::HIDDEN_SINGLE_ROW) + getLogCount(solveInstructions, LogItem::HIDDEN_SINGLE_COLUMN) + getLogCount(solveInstructions, LogItem::HIDDEN_SINGLE_SECTION); }
/** * Get the number of cells for which the solution was determined * because there was only one possible value for that cell. */ int BoardGenerator::getSingleCount(){ return getLogCount(solveInstructions, LogItem::SINGLE); }