Print the FHE operations your contracts perform in Hardhat 3 test output
The mock MockTaskManager can print every FHE operation it runs. Under Hardhat 3 this logging is off until you turn it on, so wrap the code you want to inspect in withLogs.
Each FHE operation prints one line with the operation name, its inputs, and its result. Each handle is shortened and followed, in brackets, by the plaintext the mock stores for it:
The logging switch is the logOps flag in MockTaskManager storage. The contract declares it true, but that default is set by the constructor. The plugin places MockTaskManager with hardhat_setCode, which skips the constructor, so the flag starts as false on every new connection.Because the flag lives onchain, each helper above is a transaction on the current chain, and every new connection starts with logging off again.
The config type accepts cofhe.logMocks, but no plugin code reads it. Setting it to true does not turn logging on.
The cofhe:set-log-ops task also flips the flag, but it opens a connection of its own. Against the in-process network that is a separate chain, so the task does not affect your tests. Use the helpers above instead.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Fhenix Documentation","description":"Documentation for Fhenix products: CoFHE and the Wallet Module.","colors":{"primary":"#0AD9DC","light":"#5FE8EA","dark":"#089EA1"},"logo":{"light":"https://mintcdn.com/fhenix/QsDx0SV0x2gd-xtZ/logo/light.svg?fit=max\u0026auto=format\u0026n=QsDx0SV0x2gd-xtZ\u0026q=85\u0026s=305de5e4f0ced7831f511f54c3836db2","dark":"https://mintcdn.com/fhenix/QsDx0SV0x2gd-xtZ/logo/dark.svg?fit=max\u0026auto=format\u0026n=QsDx0SV0x2gd-xtZ\u0026q=85\u0026s=85c3ae8ba2fc56ae4f71b99ff75cfefe"},"favicon":"https://mintcdn.com/fhenix/QsDx0SV0x2gd-xtZ/favicon.svg?fit=max\u0026auto=format\u0026n=QsDx0SV0x2gd-xtZ\u0026q=85\u0026s=1d44b00f5eeec228c407208538172b90","navbar":{"links":[{"icon":"github","href":"https://github.com/fhenixprotocol/","label":"Github"}],"primary":{"type":"button","label":"support","href":"https://t.me/+OEO4CItQYh8xYzNh"}},"footer":{"socials":{"x":"https://x.com/fhenix","github":"https://github.com/fhenixprotocol","discord":"https://discord.com/invite/FuVgxrvJMY"}},"seo":{"metatags":{"og:site_name":"Fhenix Documentation","og:type":"website","twitter:card":"summary","twitter:site":"@fhenix"}},"integrations":{"ga4":{"measurementId":"G-NKHXME4286"}},"contextual":{"options":["copy","chatgpt","claude","cursor"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"fhenix","hasAudioNarration":false,"actualSubdomain":"fhenix","customDomains":["cofhe-docs.fhenix.zone","docs.fhenix.io"],"gitSource":{"type":"github","owner":"fhenixprotocol","repo":"fhenix-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae36a4f878abd4f8baebabe","collectionId":"6fea768d-61a0-4383-aa70-4b1aea5b7f81","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae36a4f878abd4f8baebabe"},"feedback":{"thumbs":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae36a4f878abd4f8baebabe","clientVersion":"0.0.4054","searchFilterCounts":[{"language":"default","tag":"CoFHE","count":106},{"language":"default","tag":"FHE library","count":43},{"language":"default","tag":"Client SDK","count":36},{"language":"default","tag":"Wallet Module","count":18},{"language":"default","tag":"Reference","count":15},{"language":"default","tag":"Deep Dive","count":15},{"language":"default","tag":"Confidential Contracts","count":15},{"language":"default","tag":"Introduction","count":13},{"language":"default","tag":"Core Concepts","count":12},{"language":"default","tag":"Use the wallet","count":12}]},"assistantConfig":{"enableAskAiButton":true,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"cofhe/client-sdk/hardhat-3-plugin/logging","slug":"/cofhe/client-sdk/hardhat-3-plugin/logging","pageMetadata":{"title":"Logging","description":"Print the FHE operations your contracts perform in Hardhat 3 test output","href":"/cofhe/client-sdk/hardhat-3-plugin/logging"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Print the FHE operations your contracts perform in Hardhat 3 test output\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The mock `,_jsx(_components.code,{children:`MockTaskManager`}),` can print every FHE operation it runs. Under Hardhat 3 this logging is off until you turn it on, so wrap the code you want to inspect in `,_jsx(_components.code,{children:`withLogs`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`what-gets-logged`,children:`What gets logged`}),`\n`,_jsx(_components.p,{children:`Each FHE operation prints one line with the operation name, its inputs, and its result. Each handle is shortened and followed, in brackets, by the plaintext the mock stores for it:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`┌──────────────────┬──────────────────────────────────────────────────`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`│ [COFHE-MOCKS] │ \"counter.increment()\" logs:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├──────────────────┴──────────────────────────────────────────────────`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├ FHE.asEuint32 | uint32(1) => euint32(1157..3648)[1]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├ FHE.asEuint32 | uint32(0) => euint32(4473..3424)[0]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├ FHE.add | euint32(4473..3424)[0] + euint32(1157..3648)[1] => euint32(1106..1872)[1]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├ FHE.allowThis | euint32(1106..1872)[1] -> 0x0dcd1bf9a1b36ce34237eeafef220932846bcd82`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`├ FHE.allow | euint32(1106..1872)[1] -> 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`└─────────────────────────────────────────────────────────────────────`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(Heading,{level:`2`,id:`log-one-block-with-withlogs`,children:[`Log one block with `,_jsx(_components.code,{children:`withLogs`})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`cofhe.mocks.withLogs(name, fn)`}),` turns logging on, runs `,_jsx(_components.code,{children:`fn`}),`, and prints `,_jsx(_components.code,{children:`name`}),` as the header of the block:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cofhe`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mocks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`withLogs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'counter.increment()'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` counter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`increment`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`fn`}),` returns or throws, `,_jsx(_components.code,{children:`withLogs`}),` closes the block and turns logging back off if it was off before.`]}),`\n`,_jsx(Heading,{level:`2`,id:`turn-logging-on-and-off`,children:`Turn logging on and off`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`enableLogs(label?)`}),` and `,_jsx(_components.code,{children:`disableLogs()`}),` leave logging on across several calls:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cofhe`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mocks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`enableLogs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'counter.increment()'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` counter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`increment`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` counter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`write`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`increment`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` cofhe`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`mocks`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`disableLogs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The optional label prints a header immediately, so you can find the section in the output.`}),`\n`,_jsx(Heading,{level:`2`,id:`why-logging-starts-off`,children:`Why logging starts off`}),`\n`,_jsxs(_components.p,{children:[`The logging switch is the `,_jsx(_components.code,{children:`logOps`}),` flag in `,_jsx(_components.code,{children:`MockTaskManager`}),` storage. The contract declares it `,_jsx(_components.code,{children:`true`}),`, but that default is set by the constructor. The plugin places `,_jsx(_components.code,{children:`MockTaskManager`}),` with `,_jsx(_components.code,{children:`hardhat_setCode`}),`, which skips the constructor, so the flag starts as `,_jsx(_components.code,{children:`false`}),` on every new connection.`]}),`\n`,_jsx(_components.p,{children:`Because the flag lives onchain, each helper above is a transaction on the current chain, and every new connection starts with logging off again.`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`The config type accepts `,_jsx(_components.code,{children:`cofhe.logMocks`}),`, but no plugin code reads it. Setting it to `,_jsx(_components.code,{children:`true`}),` does not turn logging on.`]})}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`cofhe:set-log-ops`}),` task also flips the flag, but it opens a connection of its own. Against the in-process network that is a separate chain, so the task does not affect your tests. Use the helpers above instead.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Logging","description":"Print the FHE operations your contracts perform in Hardhat 3 test output","href":"/cofhe/client-sdk/hardhat-3-plugin/logging"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"What gets logged","slug":"what-gets-logged","depth":2,"children":[]},{"title":"Log one block with withLogs","slug":"log-one-block-with-withlogs","depth":2,"children":[]},{"title":"Turn logging on and off","slug":"turn-logging-on-and-off","depth":2,"children":[]},{"title":"Why logging starts off","slug":"why-logging-starts-off","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"fhenix","siteName":"Fhenix Documentation","title":"Logging - Fhenix Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-14T10:26:46.326Z","originalFileLocation":"cofhe/client-sdk/hardhat-3-plugin/logging.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Print the FHE operations your contracts perform in Hardhat 3 test output\">\u003cmeta data-mint-head name=\"application-name\" content=\"Fhenix Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Logging - Fhenix Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Print the FHE operations your contracts perform in Hardhat 3 test output\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Fhenix Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://fhenix.mintlify.app/_mintlify/api/og/v2?division=Hardhat+3+Plugin\u0026amp;title=Logging\u0026amp;description=Print+the+FHE+operations+your+contracts+perform+in+Hardhat+3+test+output\u0026amp;theme=b7e140db94e370d559b9133f\u0026amp;signature=693da21f8c535103534b10192d6678ecd55cf60f22d51837ba2bac6e56f5cdbf\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Logging - Fhenix Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Print the FHE operations your contracts perform in Hardhat 3 test output\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://fhenix.mintlify.app/_mintlify/api/og/v2?division=Hardhat+3+Plugin\u0026amp;title=Logging\u0026amp;description=Print+the+FHE+operations+your+contracts+perform+in+Hardhat+3+test+output\u0026amp;theme=b7e140db94e370d559b9133f\u0026amp;signature=693da21f8c535103534b10192d6678ecd55cf60f22d51837ba2bac6e56f5cdbf\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/fhenix/6My8uy_iS97zuzuy/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Fhenix Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0AD9DC\">\u003clink data-mint-head rel=\"canonical\" href=\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/cofhe/client-sdk/hardhat-3-plugin/logging.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://cofhe-docs.fhenix.zone/#organization\",\"name\":\"Fhenix Documentation\",\"url\":\"https://cofhe-docs.fhenix.zone\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/fhenix/QsDx0SV0x2gd-xtZ/logo/light.svg?fit=max\u0026auto=format\u0026n=QsDx0SV0x2gd-xtZ\u0026q=85\u0026s=305de5e4f0ced7831f511f54c3836db2\"}},{\"@type\":\"WebSite\",\"@id\":\"https://cofhe-docs.fhenix.zone#website\",\"name\":\"Fhenix Documentation\",\"url\":\"https://cofhe-docs.fhenix.zone\",\"publisher\":{\"@id\":\"https://cofhe-docs.fhenix.zone/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging#webpage\",\"url\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging\",\"name\":\"Logging\",\"description\":\"Print the FHE operations your contracts perform in Hardhat 3 test output\",\"dateModified\":\"2026-10-14T10:26:46.326Z\",\"isPartOf\":{\"@id\":\"https://cofhe-docs.fhenix.zone#website\"},\"breadcrumb\":{\"@id\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hardhat 3 Plugin\",\"item\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/getting-started\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Logging\",\"item\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging#article\",\"headline\":\"Logging\",\"name\":\"Logging\",\"description\":\"Print the FHE operations your contracts perform in Hardhat 3 test output\",\"url\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging\",\"mainEntityOfPage\":{\"@id\":\"https://cofhe-docs.fhenix.zone/cofhe/client-sdk/hardhat-3-plugin/logging#webpage\"},\"dateModified\":\"2026-10-14T10:26:46.326Z\",\"publisher\":{\"@id\":\"https://cofhe-docs.fhenix.zone/#organization\"},\"isPartOf\":{\"@id\":\"https://cofhe-docs.fhenix.zone#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Fhenix Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Fhenix Documentation","nav":{"global":null,"products":[{"product":"All products","icon":"grid-2","pages":[{"title":"All products","href":""}]},{"product":"CoFHE","icon":"lock","tabs":[{"tab":"Get Started","pages":[{"title":"Get Started","href":"/cofhe"}]},{"tab":"Client SDK","groups":[{"group":"Introduction","pages":[{"title":"Overview","href":"/cofhe/client-sdk/introduction/overview"},{"title":"Mental Model","href":"/cofhe/client-sdk/introduction/mental-model"},{"title":"Installation","href":"/cofhe/client-sdk/introduction/installation"},{"title":"Migrating to 0.7","href":"/cofhe/client-sdk/introduction/migrating-to-0-7"},{"title":"Migrating from cofhejs","href":"/cofhe/client-sdk/introduction/migrating-from-cofhejs"}]},{"group":"Quick Start","pages":[{"title":"Quick Start: JavaScript","href":"/cofhe/client-sdk/quick-start/javascript"},{"title":"Quick Start: Hardhat","href":"/cofhe/client-sdk/quick-start/hardhat"},{"title":"Quick Start: Foundry","href":"/cofhe/client-sdk/quick-start/foundry"},{"title":"Quick Start: React","href":"/cofhe/client-sdk/quick-start/react"}]},{"group":"Guides","pages":[{"title":"Client Setup","href":"/cofhe/client-sdk/guides/client-setup"},{"title":"Encrypting Inputs","href":"/cofhe/client-sdk/guides/encrypting-inputs"},{"title":"Writing Encrypted Data to Contract","href":"/cofhe/client-sdk/guides/writing-encrypted-data"},{"title":"Access Control Permissions (ACP)","href":"/cofhe/client-sdk/guides/acps"},{"title":"Decrypt to View","href":"/cofhe/client-sdk/guides/decrypt-to-view"},{"title":"Decrypt to Transact","href":"/cofhe/client-sdk/guides/decrypt-to-tx"},{"title":"Writing Decrypt Result to Contract","href":"/cofhe/client-sdk/guides/writing-decrypt-result"},{"title":"Error Handling","href":"/cofhe/client-sdk/guides/error-handling"}]},{"group":"Hardhat Plugin","pages":[{"title":"Getting Started","href":"/cofhe/client-sdk/hardhat-plugin/getting-started"},{"title":"Client","href":"/cofhe/client-sdk/hardhat-plugin/client"},{"title":"Mock Contracts","href":"/cofhe/client-sdk/hardhat-plugin/mock-contracts"},{"title":"Logging","href":"/cofhe/client-sdk/hardhat-plugin/logging"},{"title":"Testing","href":"/cofhe/client-sdk/hardhat-plugin/testing"}]},{"group":"Hardhat 3 Plugin","pages":[{"title":"Getting Started","href":"/cofhe/client-sdk/hardhat-3-plugin/getting-started"},{"title":"Client","href":"/cofhe/client-sdk/hardhat-3-plugin/client"},{"title":"Mock Contracts","description":"Read plaintext values and call the CoFHE mock contracts in Hardhat 3 tests","href":"/cofhe/client-sdk/hardhat-3-plugin/mock-contracts"},{"title":"Logging","href":"/cofhe/client-sdk/hardhat-3-plugin/logging"},{"title":"Testing","description":"A complete Hardhat 3 test for an FHE contract, and the patterns around it","href":"/cofhe/client-sdk/hardhat-3-plugin/testing"}]},{"group":"Foundry Plugin","pages":[{"title":"Getting Started","href":"/cofhe/client-sdk/foundry-plugin/getting-started"},{"title":"CofheTest","href":"/cofhe/client-sdk/foundry-plugin/cofhe-test"},{"title":"CofheClient","href":"/cofhe/client-sdk/foundry-plugin/cofhe-client"},{"title":"Testing","href":"/cofhe/client-sdk/foundry-plugin/testing"}]},{"group":"Examples","pages":[{"title":"End-to-End Example","href":"/cofhe/client-sdk/examples/end-to-end"},{"title":"Templates \u0026 Starters","href":"/cofhe/client-sdk/examples/templates"}]},{"group":"Reference","pages":[{"title":"SDK Reference","href":"/cofhe/client-sdk/reference/sdk-reference"},{"title":"Hardhat Plugin Reference","href":"/cofhe/client-sdk/reference/hardhat-reference"},{"title":"Foundry Plugin Reference","href":"/cofhe/client-sdk/reference/foundry-reference"}]}],"global":{"anchors":[{"anchor":"Github","icon":"github","href":"https://github.com/FhenixProtocol/cofhesdk"}]}},{"tab":"FHE library","pages":[{"title":"FHE library","href":"/cofhe/fhe-library/introduction/overview"}]},{"tab":"Tutorials","pages":[{"title":"Tutorials","href":"/cofhe/tutorials/overview"}]},{"tab":"Deep Dive","pages":[{"title":"Deep Dive","href":"/cofhe/deep-dive/cofhe-components/overview"}]}]},{"product":"Wallet Module","icon":"wallet","pages":[{"title":"Wallet Module","href":"/wallet"}]},{"product":"Trading","icon":"chart-line","pages":[{"title":"Trading","href":"/trading"}]}]},"basePath":"","title":"Logging - Fhenix Documentation","buildId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","deploymentId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","dynamics":[],"chunks":[]}