gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 02/02: harness: observability


From: gnunet
Subject: [taler-wallet-core] 02/02: harness: observability
Date: Wed, 06 Mar 2024 08:49:19 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

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

    harness: observability
---
 packages/taler-harness/src/harness/helpers.ts | 24 +++++++++++++++++-------
 packages/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
index 46dc9f9d4..ea9047d0b 100644
--- 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
index b81c56e0c..d7623baab 100644
--- 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;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]