From bb9cdbd15e4bc5635f87202f2657e582f0a88c5a Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 16 May 2022 00:10:08 -0400 Subject: [PATCH] Log primitive response values --- node/README.md | 2 ++ node/src/client.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/node/README.md b/node/README.md index 9419caf..0d2aa89 100644 --- a/node/README.md +++ b/node/README.md @@ -8,3 +8,5 @@ If `type` is `tcp`, `port` and `host` are the host/port where to listen. ### Logging config `logging_keys` specifies which properties of RPC request & response objects to print in logs. Optional. + +A special-case logging key for responses is `value`, which enables logging responses that are primitives instead of objects. diff --git a/node/src/client.js b/node/src/client.js index 1398fdf..d29791e 100644 --- a/node/src/client.js +++ b/node/src/client.js @@ -1322,7 +1322,7 @@ export default class PeerClient { logger( `Response ${resp.id}:`, this.#logObj( - resp.response, + resp.response instanceof Object ? resp.response : {value: resp.response}, success ? "success" : "failure", this.loggingKeys.response )