A note on console.log
In the previous example, you used console.log to output basic debugging information. Keep in mind that Solidity’s console.log is more limited than what you might be used to in other programming languages, where nearly any data type can be logged.
In Solidity, console.log supports up to four parameters of the following types:
1. uint 2. string 3. bool 4. address
Hardhat also provides additional logging functions to support other types, including:
- console.logInt(int i) - console.logBytes(bytes memory b) - console.logBytes1(bytes1 b) - console.logBytes2(bytes2 b) - ... - console.logBytes32(bytes32 b)
These functions are useful when you need to log values outside the basic supported types. For more information, consult the official console.log documentation.
Last updated