taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 12d2157cd71e9b0d93b70783694997ea5eb7cdb8
parent a7d034920ed7e81624e8e83808f2ee93dfc321f3
Author: Florian Dold <florian@dold.me>
Date:   Wed,  6 Mar 2024 08:48:57 +0100

harness: observability

Diffstat:
Mpackages/taler-harness/src/harness/helpers.ts | 24+++++++++++++++++-------
Mpackages/taler-wallet-core/src/remote.ts | 2--
2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts @@ -422,22 +422,32 @@ export async function createWalletDaemonWithClient( await walletService.start(); await walletService.pingUntilAvailable(); + const observabilityEventFile = t.testDir + `/wallet-${args.name}-notifs.log`; + + const onNotif = (notif: WalletNotification) => { + if (observabilityEventFile) { + fs.appendFileSync( + observabilityEventFile, + new Date().toISOString() + " " + JSON.stringify(notif) + "\n", + ); + } + if (args.handleNotification) { + args.handleNotification(notif); + } + }; + const walletClient = new WalletClient({ name: args.name, unixPath: walletService.socketPath, - onNotification(n) { - console.log(`got ${args.name} notification`, n); - if (args.handleNotification) { - args.handleNotification(n); - } - }, + onNotification: onNotif, }); await walletClient.connect(); const defaultRunConfig = { testing: { skipDefaults: true, + emitObservabilityEvents: !!process.env["TALER_TEST_OBSERVABILITY"], }, - }; + } satisfies PartialWalletRunConfig; await walletClient.client.call(WalletApiOperation.InitWallet, { config: args.config ?? defaultRunConfig, }); diff --git a/packages/taler-wallet-core/src/remote.ts b/packages/taler-wallet-core/src/remote.ts @@ -17,7 +17,6 @@ import { CoreApiRequestEnvelope, CoreApiResponse, - j2s, Logger, OpenedPromise, openPromise, @@ -92,7 +91,6 @@ export async function createRemoteWallet( onMessage(m) { // FIXME: use a codec for parsing the response envelope! - logger.info(`${args.name}: got message from remote: ${j2s(m)}`); if (typeof m !== "object" || m == null) { logger.warn(`${args.name}: message not understood (wrong type)`); return;