Logging library that reduces the time spent writing the same logging functions again and again.
- Numbers formatting
- Line delimiters
- Logs indentation
- Binary and hex representation of numbers
See
SLConsole.t.sol
for examples
Install it as a dependency:
forge install git@github.com:georgiIvanov/solc-log.git
Update remappings.txt
:
solc-log/=lib/solc-log/src/
Import logging library:
import {sl} from "solc-log/sl.sol";
Make sure to add verbose logging to your command, example:
forge test --mc ContractName -vv
To run all tests:
forge test -vv
- If you don't see logs, make sure you are running a normal unit test. Currently Forge does not support logging in fuzz tests.
- Does not work with hardhat traces.
- Log bytes, similar to console2.logBytes
- Parameterized indent / outdent
- Decimal places for bits, Q notation (X96 or X128). Example:
uint160 sqrtPriceX96 = Q64.X96
(whole part is 64 bits)