[UPDATE] Logfile cleanup

* [REMOVED] Do not show row headers at each cron run
* [REMOVED] Extra newlines in notification cron
This commit is contained in:
Sebastian Grewe 2014-01-25 21:35:02 +01:00
parent a343ac4047
commit 643c21d3a7
3 changed files with 14 additions and 12 deletions

View File

@ -33,8 +33,9 @@ if ( $bitcoin->can_connect() !== true ) {
// Fetch all unconfirmed blocks
$aAllBlocks = $block->getAllUnconfirmed(max($config['network_confirmations'],$config['confirmations']));
$log->logInfo("ID\tHeight\tBlockhash\tConfirmations");
$header = false;
foreach ($aAllBlocks as $iIndex => $aBlock) {
!$header ? $log->logInfo("ID\tHeight\tBlockhash\tConfirmations") : $header = true;
$aBlockInfo = $bitcoin->getblock($aBlock['blockhash']);
// Fetch this blocks transaction details to find orphan blocks
$aTxDetails = $bitcoin->gettransaction($aBlockInfo['tx'][0]);

View File

@ -42,12 +42,13 @@ if ( $bitcoin->can_connect() === true ){
if (empty($aTransactions['transactions'])) {
$log->logDebug('No new RPC transactions since last block');
} else {
// Table header
$log->logInfo("Blockhash\t\tHeight\tAmount\tConfirmations\tDiff\t\tTime");
$header = false;
// Let us add those blocks as unaccounted
foreach ($aTransactions['transactions'] as $iIndex => $aData) {
if ( $aData['category'] == 'generate' || $aData['category'] == 'immature' ) {
// Table header, printe once if we found a block
!$header ? $log->logInfo("Blockhash\t\tHeight\tAmount\tConfirmations\tDiff\t\tTime") : $header = true;
$aBlockRPCInfo = $bitcoin->getblock($aData['blockhash']);
$config['reward_type'] == 'block' ? $aData['amount'] = $aData['amount'] : $aData['amount'] = $config['reward'];
$aData['height'] = $aBlockRPCInfo['height'];

View File

@ -33,9 +33,9 @@ $log->logDebug(" IDLE Worker Notifications ...");
// Find all IDLE workers
$aWorkers = $worker->getAllIdleWorkers();
if (empty($aWorkers)) {
$log->logDebug(" no idle workers found\n");
$log->logDebug(" no idle workers found");
} else {
$log->logInfo(" found " . count($aWorkers) . " IDLE workers\n");
$log->logInfo(" found " . count($aWorkers) . " IDLE workers");
foreach ($aWorkers as $aWorker) {
$aData = $aWorker;
$aData['username'] = $user->getUserName($aWorker['account_id']);
@ -44,7 +44,7 @@ if (empty($aWorkers)) {
$aData['email'] = $user->getUserEmail($aData['username']);
$log->logDebug(" " . $aWorker['username'] . "...");
if (!$notification->sendNotification($aWorker['account_id'], 'idle_worker', $aData))
$log->logDebug(" Failed sending notifications: " . $notification->getCronError() . "\n");
$log->logDebug(" Failed sending notifications: " . $notification->getCronError());
}
}
@ -53,23 +53,23 @@ $log->logDebug(" Reset IDLE Worker Notifications ...");
// We notified, lets check which recovered
$aNotifications = $notification->getAllActive('idle_worker');
if (!empty($aNotifications)) {
$log->logInfo(" found " . count($aNotifications) . " active notification(s)\n");
$log->logInfo(" found " . count($aNotifications) . " active notification(s)");
foreach ($aNotifications as $aNotification) {
$aData = json_decode($aNotification['data'], true);
$aWorker = $worker->getWorker($aData['id']);
$log->logDebug(" " . $aWorker['username'] . " ...");
if ($aWorker['hashrate'] > 0) {
if ($notification->setInactive($aNotification['id'])) {
$log->logDebug(" updated #" . $aNotification['id'] . " for " . $aWorker['username'] . " as inactive\n");
$log->logDebug(" updated #" . $aNotification['id'] . " for " . $aWorker['username'] . " as inactive");
} else {
$log->logError(" failed to update #" . $aNotification['id'] . " for " . $aWorker['username'] . "\n");
$log->logError(" failed to update #" . $aNotification['id'] . " for " . $aWorker['username']);
}
} else {
$log->logDebug(" still inactive\n");
$log->logDebug(" still inactive");
}
}
} else {
$log->logDebug(" no active IDLE worker notifications\n");
$log->logDebug(" no active IDLE worker notifications");
}
require_once('cron_end.inc.php');