feat: add fetchCanisterLogs method to PocketIc#235
Open
yasumorishima wants to merge 1 commit intodfinity:mainfrom
Open
feat: add fetchCanisterLogs method to PocketIc#235yasumorishima wants to merge 1 commit intodfinity:mainfrom
yasumorishima wants to merge 1 commit intodfinity:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
fetchCanisterLogs()method to thePocketIcclass, implementing thefetch_canister_logsmanagement canister query call.This allows users to programmatically retrieve canister log records, which is especially useful for debugging traps in timers and heartbeats that are otherwise invisible.
Closes #68
Changes
management-canister.ts: Add Candid IDL types, TypeScript interfaces, and encode/decode functions forfetch_canister_logspocket-ic-types.ts: AddFetchCanisterLogsOptionsandCanisterLogRecordpublic typespocket-ic.ts: AddfetchCanisterLogs()method that makes a query call to the management canister witheffectivePrincipalset to the target canistermain.mo: Addprint_logmethod to test canister for testingfetchCanisterLogs.spec.ts: Add 2 test cases (fetch logs afterDebug.print+ empty logs for fresh canister)Implementation notes
effectivePrincipal: { canisterId }as required by the IC spec for management canister queriestimestamp_nanostotimestampNanosin the public type to follow the project's camelCase conventionTest plan
pnpm run buildpassespnpm run test:pic— all 13 tests pass (11 existing + 2 new)pnpm run format:checkpasses