change long_msg output format

This commit is contained in:
Lotfi zaouche 2020-04-09 09:50:29 +00:00
parent bcb95743d9
commit 94d5eafd13
5 changed files with 33 additions and 33 deletions

View File

@ -65,9 +65,9 @@ sub manage_selection {
# $cache->set('fork_timestamp', $res_timestamp);
# }
$self->{output}->output_add(severity => 'OK', long_msg => '[Fork]: fork_timestamp: ' . $res_timestamp .
' | fork_occurence: ' . $result->{occurence} . ' | fork_blockNumber: ' . $result->{last_update}->{blockNumber} .
' | fork_in: ' . $result->{last_update}->{in} . ' | fork_out: ' . $result->{last_update}->{out} );
$self->{output}->output_add(severity => 'OK', long_msg => 'Fork: [fork_timestamp: ' . $res_timestamp .
'] [fork_occurence: ' . $result->{occurence} . '] [fork_blockNumber: ' . $result->{last_update}->{blockNumber} .
'] [fork_in: ' . $result->{last_update}->{in} . '] [fork_out: ' . $result->{last_update}->{out} . ']');
}

View File

@ -59,9 +59,9 @@ sub manage_selection {
next;
}
$self->{output}->output_add(severity => 'OK', long_msg => '[Account ' . $account->{id} . ']: label: ' . $account->{label} . ' | nonce: ' . $account->{nonce} .
' | timestamp: ' . localtime(hex($account->{last_update}->{timestamp})) . ' | blockNumber: ' . $account->{last_update}->{blockNumber} .
' | receiver: ' . $account->{last_update}->{receiver} . ' | value: ' . $account->{last_update}->{value} );
$self->{output}->output_add(severity => 'OK', long_msg => 'Account ' . $account->{id} . ': [label: ' . $account->{label} . '] [nonce: ' . $account->{nonce} .
'] [timestamp: ' . localtime(hex($account->{last_update}->{timestamp})) . '] [blockNumber: ' . $account->{last_update}->{blockNumber} .
'] [receiver: ' . $account->{last_update}->{receiver} . '] [value: ' . $account->{last_update}->{value} . ']' );
}
foreach my $minner (@{$results->{Miners}}) {
@ -71,8 +71,8 @@ sub manage_selection {
next;
}
$self->{output}->output_add(severity => 'OK', long_msg => '[Minner ' . $minner->{id} . ']: label: ' . $minner->{label} . ' | blocks: ' . $minner->{blocks} .
' | timestamp: ' . localtime(hex($minner->{last_update}->{timestamp})) . ' | blockNumber: ' . $minner->{last_update}->{blockNumber} );
$self->{output}->output_add(severity => 'OK', long_msg => 'Minner ' . $minner->{id} . ': [label: ' . $minner->{label} . '] [blocks: ' . $minner->{blocks} .
'] [timestamp: ' . localtime(hex($minner->{last_update}->{timestamp})) . '] [blockNumber: ' . $minner->{last_update}->{blockNumber} . ']');
}
foreach my $contract (@{$results->{Constracts}}) {
@ -82,9 +82,9 @@ sub manage_selection {
next;
}
$self->{output}->output_add(severity => 'OK', long_msg => '[Contract ' . $contract->{id} . ']: label: ' . $contract->{label} . ' | balance: ' . $contract->{balance} .
' | timestamp: ' . localtime(hex($contract->{last_update}->{timestamp})) . ' | blockNumber: ' . $contract->{last_update}->{blockNumber} .
' | sender: ' . $contract->{last_update}->{sender} . ' | value: ' . $contract->{last_update}->{value} );
$self->{output}->output_add(severity => 'OK', long_msg => 'Contract ' . $contract->{id} . ': [label: ' . $contract->{label} . '] [balance: ' . $contract->{balance} .
'] [timestamp: ' . localtime(hex($contract->{last_update}->{timestamp})) . '] [blockNumber: ' . $contract->{last_update}->{blockNumber} .
'] [sender: ' . $contract->{last_update}->{sender} . '] [value: ' . $contract->{last_update}->{value} . ']');
# if (my $cached_balance = $cache->get('contract_balance_' . $contract->{id})) {
# if ($cached_balance != $contract->{balance}) {
@ -103,10 +103,10 @@ sub manage_selection {
next;
}
$self->{output}->output_add(severity => 'OK', long_msg => '[Function ' . $function->{id} . ']: label: ' . $function->{label} . ' | calls: ' . $function->{calls} .
' | timestamp: ' . localtime(hex($function->{last_update}->{timestamp})) . ' | blockNumber: ' . $function->{last_update}->{blockNumber} .
' | sender: ' . $function->{last_update}->{sender} . ' | receiver: ' . $function->{last_update}->{receiver} .
' | value: ' . $function->{last_update}->{value} );
$self->{output}->output_add(severity => 'OK', long_msg => '[Function ' . $function->{id} . ']: label: ' . $function->{label} . '] [calls: ' . $function->{calls} .
'] [timestamp: ' . localtime(hex($function->{last_update}->{timestamp})) . '] [blockNumber: ' . $function->{last_update}->{blockNumber} .
'] [sender: ' . $function->{last_update}->{sender} . '] [receiver: ' . $function->{last_update}->{receiver} .
'] [value: ' . $function->{last_update}->{value} . ']');
}
foreach my $event (@{$results->{Events}}) {
@ -116,9 +116,9 @@ sub manage_selection {
next;
}
$self->{output}->output_add(severity => 'OK', long_msg => '[Event ' . $event->{id} . ']: label: ' . $event->{label} . ' | calls: ' . $event->{calls} .
' | timestamp: ' . localtime(hex($event->{last_update}->{timestamp})) . ' | blockNumber: ' . $event->{last_update}->{blockNumber} .
' | sender: ' . $event->{last_update}->{sender} . ' | receiver: ' . $event->{last_update}->{receiver});
$self->{output}->output_add(severity => 'OK', long_msg => '[Event ' . $event->{id} . ']: label: ' . $event->{label} . '] [calls: ' . $event->{calls} .
'] [timestamp: ' . localtime(hex($event->{last_update}->{timestamp})) . '] [blockNumber: ' . $event->{last_update}->{blockNumber} .
'] [sender: ' . $event->{last_update}->{sender} . '] [receiver: ' . $event->{last_update}->{receiver} . ']');
}
}

View File

@ -180,14 +180,14 @@ sub manage_selection {
block_uncles => scalar(@{$$result[5]->{result}->{uncles}}),
block_transactions => scalar(@{$$result[5]->{result}->{transactions}})};
$self->{output}->output_add(severity => 'OK', long_msg => '[Node status] is_mining: ' . @{$result}[0]->{result} . ' | sync_start: ' . $res_startingBlock .
' | sync_current: ' . $res_currentBlock . ' | sync_highest: ' . $res_highestBlock . ' | sync: ' . $res_sync . '%%');
$self->{output}->output_add(severity => 'OK', long_msg => '[Client] coinbase: ' . @{$result}[1]->{result});
$self->{output}->output_add(severity => 'OK', long_msg => '[Global] hashrate: ' . hex(@{$result}[3]->{result}) .
' | block_number: ' . (defined @{$result}[4]->{result} ? hex(@{$result}[4]->{result}) : 0));
$self->{output}->output_add(severity => 'OK', long_msg => '[Last block] block_time: ' . localtime(hex(@{$result}[5]->{result}->{timestamp})) . ' | block_gas_limit: ' . hex(@{$result}[5]->{result}->{gasLimit}) .
' | block_miner: ' . @{$result}[5]->{result}->{miner} . ' | block_hash: ' . @{$result}[5]->{result}->{hash} .
' | last_block_number: ' . hex(@{$result}[5]->{result}->{number}));
$self->{output}->output_add(severity => 'OK', long_msg => 'Node status: [is_mining: ' . @{$result}[0]->{result} . '] [sync_start: ' . $res_startingBlock .
'] [sync_current: ' . $res_currentBlock . '] [sync_highest: ' . $res_highestBlock . '] [sync: ' . $res_sync . '%%]');
$self->{output}->output_add(severity => 'OK', long_msg => 'Client: [coinbase: ' . @{$result}[1]->{result} . ']');
$self->{output}->output_add(severity => 'OK', long_msg => 'Global: [hashrate: ' . hex(@{$result}[3]->{result}) .
'] [block_number: ' . (defined @{$result}[4]->{result} ? hex(@{$result}[4]->{result}) : 0) . ']');
$self->{output}->output_add(severity => 'OK', long_msg => 'Last block: [block_time: ' . localtime(hex(@{$result}[5]->{result}->{timestamp})) . '] [block_gas_limit: ' . hex(@{$result}[5]->{result}->{gasLimit}) .
'] [block_miner: ' . @{$result}[5]->{result}->{miner} . '] [block_hash: ' . @{$result}[5]->{result}->{hash} .
'] [last_block_number: ' . hex(@{$result}[5]->{result}->{number}) . ']');
}

View File

@ -109,7 +109,7 @@ sub manage_selection {
$self->{network} = { peers => hex(@{$result}[1]->{result}) };
$self->{output}->output_add(long_msg => "[Node] is_listening: " . $peer_count, severity => 'OK');
$self->{output}->output_add(long_msg => "Node status: [is_listening: " . $peer_count . ']', severity => 'OK');
}
1;

View File

@ -117,12 +117,12 @@ sub manage_selection {
# use Data::Dumper;
# print Dumper($result);
$self->{output}->output_add(long_msg => "[config] chain name: " . @{$result}[1]->{result} . " | parity version: " . $res_parity_version . " | version_hash: "
. @{$result}[0]->{result}->{hash}, severity => 'OK');
$self->{output}->output_add(long_msg => "[Network] peers_connected: " . @{$result}[3]->{result}->{connected} . " | peers_max: " . @{$result}[3]->{result}->{max} . " | peers: "
. scalar(@{$$result[3]->{result}->{peers}}), severity => 'OK');
$self->{output}->output_add(long_msg => "[Node] node_name: " . @{$result}[5]->{result} . " | enode: " . @{$result}[4]->{result} , severity => 'OK');
$self->{output}->output_add(long_msg => "[Node] pending_transactions: " . scalar(@{$$result[2]->{result}}), severity => 'OK');
$self->{output}->output_add(long_msg => "Config: [chain name: " . @{$result}[1]->{result} . "] [parity version: " . $res_parity_version . "] [version_hash: "
. @{$result}[0]->{result}->{hash} . "]", severity => 'OK');
$self->{output}->output_add(long_msg => "Network: [peers_connected: " . @{$result}[3]->{result}->{connected} . "] [peers_max: " . @{$result}[3]->{result}->{max} . "] [peers: "
. scalar(@{$$result[3]->{result}->{peers}}) . "]", severity => 'OK');
$self->{output}->output_add(long_msg => "Node: [node_name: " . @{$result}[5]->{result} . "] [enode: " . @{$result}[4]->{result} . "]", severity => 'OK');
$self->{output}->output_add(long_msg => "Mempool: [pending_transactions: " . scalar(@{$$result[2]->{result}}) . "]", severity => 'OK');
$self->{mempool} = { mempool => scalar(@{$$result[2]->{result}}) / @{$result}[6]->{result} * 100 }; #TO CHECK division entière
}