我在我的私有区块链(本地网)中部署契约(使用console.log)。哪里能找到打印信息?我用的是我的私人区块链。在终端,我找不到打印信息。添加更多的图片来表达我的问题,我的私人区块终端。

我部署在我的私人区块链中

发布于 2022-07-14 18:42:08
您可以直接在混合中使用console.log功能。下面是一个加载在混合上的示例合同,它使用console.log打印“打印出来的东西”:

编译之后,您必须部署代码:

在deploy按钮下面,您将看到已部署的合同:

通过单击test按钮展开它并调用测试函数,您将在终端中看到输出:

为了方便起见,我还在这里分享代码:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import "hardhat/console.sol";
contract TestContract {
constructor() {
}
function test() public view {
console.log("Print something out");
}
}https://ethereum.stackexchange.com/questions/131761
复制相似问题