Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable canister logging #555

Merged
merged 7 commits into from
Jul 3, 2024
11 changes: 5 additions & 6 deletions src/frontend/src/lib/services/logs.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ export const listLogs = async ({
}

try {
const [fnLogs] = await Promise.all([
functionLogs({ satelliteId, identity })
// TODO: IC logs are not available on mainnet yet
// canisterLogs({ canisterId: satelliteId, identity })
const [fnLogs, icLogs] = await Promise.all([
functionLogs({ satelliteId, identity }),
canisterLogs({ canisterId: satelliteId, identity })
]);

return {
results: [...fnLogs]
results: [...fnLogs, ...icLogs]
.filter(([_, { level }]) => levels.includes(level))
.sort(([, { timestamp: aTimestamp }], [_, { timestamp: bTimestamp }]) =>
aTimestamp > bTimestamp ? (desc ? -1 : 1) : aTimestamp === bTimestamp ? 0 : desc ? 1 : -1
Expand Down Expand Up @@ -100,7 +99,7 @@ const functionLogs = async (params: {
return await Promise.all(fnLogs.map(mapLog));
};

const _canisterLogs = async (params: {
const canisterLogs = async (params: {
canisterId: Principal;
identity: Identity;
}): Promise<[string, Log][]> => {
Expand Down