2025-04-11 23:54:20 +00:00
|
|
|
// SPDX-License-Identifier: UNLICENSED
|
|
|
|
|
pragma solidity ^0.8.27;
|
|
|
|
|
|
|
|
|
|
import {console} from "forge-std/console.sol";
|
|
|
|
|
|
|
|
|
|
library Logging {
|
|
|
|
|
// Logging helper constants
|
2025-10-20 08:20:59 +00:00
|
|
|
string private constant HEADER1 =
|
|
|
|
|
"============================================================";
|
|
|
|
|
string private constant HEADER2 =
|
|
|
|
|
" ";
|
2025-04-11 23:54:20 +00:00
|
|
|
string private constant FOOTER = "============================================================";
|
|
|
|
|
string private constant SEPARATOR =
|
|
|
|
|
"------------------------------------------------------------";
|
|
|
|
|
|
|
|
|
|
function logHeader(
|
|
|
|
|
string memory title
|
|
|
|
|
) internal pure {
|
|
|
|
|
console.log("");
|
|
|
|
|
console.log(HEADER1);
|
|
|
|
|
console.log("| %s |", title);
|
|
|
|
|
console.log(SEPARATOR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function logSection(
|
|
|
|
|
string memory title
|
|
|
|
|
) internal pure {
|
|
|
|
|
console.log("");
|
|
|
|
|
console.log("| %s:", title);
|
|
|
|
|
console.log(SEPARATOR);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-20 08:20:59 +00:00
|
|
|
function logContractDeployed(
|
|
|
|
|
string memory name,
|
|
|
|
|
address contractAddress
|
|
|
|
|
) internal pure {
|
2025-04-11 23:54:20 +00:00
|
|
|
console.log("| [+] %s: %s", name, contractAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-20 08:20:59 +00:00
|
|
|
function logAgentOrigin(
|
|
|
|
|
string memory name,
|
|
|
|
|
string memory agentOrigin
|
|
|
|
|
) internal pure {
|
2025-06-16 10:20:18 +00:00
|
|
|
console.log("| [+] %s: %s", name, agentOrigin);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-20 08:20:59 +00:00
|
|
|
function logFunctionSelector(
|
|
|
|
|
string memory name,
|
|
|
|
|
string memory selector
|
|
|
|
|
) internal pure {
|
2025-06-16 10:20:18 +00:00
|
|
|
console.log("| [+] %s: %s", name, selector);
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-11 23:54:20 +00:00
|
|
|
function logStep(
|
|
|
|
|
string memory message
|
|
|
|
|
) internal pure {
|
|
|
|
|
console.log("| >>> %s", message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function logInfo(
|
|
|
|
|
string memory message
|
|
|
|
|
) internal pure {
|
|
|
|
|
console.log("| [i] %s", message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function logFooter() internal pure {
|
|
|
|
|
console.log(FOOTER);
|
|
|
|
|
console.log("");
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-20 08:20:59 +00:00
|
|
|
function logProgress(
|
|
|
|
|
uint16 step,
|
|
|
|
|
uint16 totalSteps
|
|
|
|
|
) internal pure {
|
2025-04-11 23:54:20 +00:00
|
|
|
console.log("");
|
|
|
|
|
console.log(
|
|
|
|
|
"Progress: Step %d/%d completed (%d%%)", step, totalSteps, (step * 100) / totalSteps
|
|
|
|
|
);
|
|
|
|
|
console.log("");
|
|
|
|
|
}
|
|
|
|
|
}
|