Commit 96272f77 authored by aniket-engg's avatar aniket-engg Committed by Aniket

comment

parent 591cd919
...@@ -504,6 +504,10 @@ class Blockchain extends Plugin { ...@@ -504,6 +504,10 @@ class Blockchain extends Plugin {
let finalLogs = 'console.log:\n' let finalLogs = 'console.log:\n'
for (const log of hhlogs) { for (const log of hhlogs) {
let formattedLog let formattedLog
// Hardhat implements the same formatting options that can be found in Node.js' console.log,
// which in turn uses util.format: https://nodejs.org/dist/latest-v12.x/docs/api/util.html#util_util_format_format_args
// For example: console.log("Name: %s, Age: %d", remix, 6) will log 'Name: remix, Age: 6'
// We check first arg to determine if 'util.format' is needed
if (typeof log[0] === 'string' && (log[0].includes('%s') || log[0].includes('%d'))) { if (typeof log[0] === 'string' && (log[0].includes('%s') || log[0].includes('%d'))) {
formattedLog = format(log[0], ...log.slice(1)) formattedLog = format(log[0], ...log.slice(1))
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment