Aim: To log data from a smart contract.
Following function is written in accordance with low level interface to Logs in ethereum. However, due to lack of documentation, and being new in Solidity, I am not able to figure out how and where to get the logs.
function:
function addNewUser(address _userAddr, uint _amount) public {
log1(
bytes32(_userAddr),
bytes32(msg.sender)
);
require(msg.sender == _userAddr); //only owner of lottery can create new Users
uint256 id = users.push(User(_amount, _userAddr)) - 1;
addressToUser[_userAddr] = id;
NewUser(_amount, _userAddr); //event to FE (no return possible in BC edit functions)
}
When i call function on truffle's console following data is displayed:
Command: lot.addNewUserToLottery(24, 0x6330a553fc93768f612722bb8c2ec78ac90b3bbc);
TRUFFLE CONSOLE
{ tx: '0xcfd479f7493f215d3f4bac54ab6331fc2dfaea88784a0f543614e22c7092ccf8',
receipt:
{ transactionHash: '0xcfd479f7493f215d3f4bac54ab6331fc2dfaea88784a0f543614e22c7092ccf8',
transactionIndex: 0,
blockHash: '0xdd0ebd3f560bd8ce143fe0a77e99818e9a072fa7b9afb79f4beca0363dfb5047',
blockNumber: 110,
gasUsed: 96578,
cumulativeGasUsed: 96578,
contractAddress: null,
logs: [ [Object], [Object] ],
status: '0x01',
logsBloom: '0x00000000000000000000000000000000000000040000000000000000000000000000008000000000000080000000000000000000000000400000000000000000000000000800000000000000000000000000000000000000040000000000000000000000000000000000001000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' },
logs: [] }
testrpc BLOCKCHAIN
develop:testrpc Gas usage: 26981 +0ms
develop:testrpc Block Number: 117 +0ms
develop:testrpc Block Time: Sat Apr 14 2018 15:25:59 GMT+0530 (IST) +0ms
develop:testrpc +0ms
develop:testrpc eth_getTransactionReceipt +1ms
develop:testrpc eth_sendTransaction +6s
develop:testrpc +48ms
develop:testrpc Transaction: 0x2f901a79252860c2200cc2923eba859ea585922a844a1aae69ee0240fe4ae45d +1ms
Where are the logs printed? Am I missing something?