Accessing Contract Prints
For debugging purposes one can add eosio::print instructions to a contract.
These printed messages can be read in Hydra by accessing the transaction trace object that is returned when executing transactions on the account contract object.
Reading contract console prints#
For a given contract with a hello action that prints the username a test could be written as follows:
Printing the contract console output to the test runner output is done by using JavaScript's console.log function:
Console prints are recorded per action
There is no single console output for a transaction, instead, each action carries its own console output in the corresponding action trace.
Make sure to access the correct action trace when dealing with inline actions or notifications to other contracts.
For example, when transferring tokens using the eosio.token contract three action traces are created, one for the initial action on the eosio.token contract and two for the notifications sent to the sender and receiver.