How to log to console with Solidity

How to log to console on Solidity

Most times, it’s convenient to know display certain information on the console to ease debugging work when working with Solidity code.

To log to console when using Remix IDE, please follow the steps below.

Step 1: Include the import line as shown below.

import "hardhat/console.sol";

Step 2: To log to console, include the code example below.

console.log("contractBaseURI:", baseURI );

where baseURI is the variable you wish to display.

Result: Your console should now output the variable data, as depicted below.