logging bytes value with string #10278
Unanswered
18121A05L2
asked this question in
Q&A
Replies: 1 comment
-
|
You can use import "forge-std/Test.sol";
import "forge-std/console.sol";
bytes32 myValue = 0xabc123...;
// Option 1 — label + bytes32 as string
console.log("myValue:", vm.toString(myValue));
// Option 2 — multiple values with labels
bytes32 hashA = keccak256("foo");
bytes32 hashB = keccak256("bar");
console.log("hashA:", vm.toString(hashA));
console.log("hashB:", vm.toString(hashB));
Alternative — use console.log("hashA:");
console.logBytes32(hashA);But |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Everyone, sometimes I need to log bytes32 value along with some string or variable name as string so that if i log multiple bytes32 , i can able to check what is what , but now i was not able to , can anyone help me with this ?
Beta Was this translation helpful? Give feedback.
All reactions