From 288920b92775b1afd063e40b3975cc1a6ebf553b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Wed, 9 Mar 2022 16:23:17 +0000 Subject: [PATCH] feat: add extra (optional) logging --- lib/cash-in/cash-in-tx.js | 1 + lib/cash-out/cash-out-tx.js | 7 +++++++ package.json | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/cash-in/cash-in-tx.js b/lib/cash-in/cash-in-tx.js index d97398da..728c4b86 100644 --- a/lib/cash-in/cash-in-tx.js +++ b/lib/cash-in/cash-in-tx.js @@ -28,6 +28,7 @@ end` module.exports = {post, monitorPending, cancel, PENDING_INTERVAL, TRANSACTION_STATES} function post (machineTx, pi) { + logger.silly('Updating cashin tx:', machineTx) return cashInAtomic.atomic(machineTx, pi) .then(r => { const updatedTx = r.tx diff --git a/lib/cash-out/cash-out-tx.js b/lib/cash-out/cash-out-tx.js index c7236b91..d6b7f82b 100644 --- a/lib/cash-out/cash-out-tx.js +++ b/lib/cash-out/cash-out-tx.js @@ -37,6 +37,7 @@ function selfPost (tx, pi) { } function post (tx, pi, fromClient = true) { + logger.silly('Updating cashout tx:', tx) return cashOutAtomic.atomic(tx, pi, fromClient) .then(txVector => { const [, newTx, justAuthorized] = txVector @@ -57,7 +58,13 @@ function postProcess (txVector, justAuthorized, pi) { if ((newTx.dispense && !oldTx.dispense) || (newTx.redeem && !oldTx.redeem)) { return pi.buildAvailableCassettes(newTx.id) .then(cassettes => { + logger.silly('Computing bills to dispense:', { + txId: newTx.id, + cassettes: cassettes.cassettes, + fiat: newTx.fiat + }) const bills = billMath.makeChange(cassettes.cassettes, newTx.fiat) + logger.silly('Bills to dispense:', bills) if (!bills) throw httpError('Out of bills', INSUFFICIENT_FUNDS_CODE) return bills diff --git a/package.json b/package.json index 59c41432..a37030dc 100644 --- a/package.json +++ b/package.json @@ -119,8 +119,8 @@ "test": "mocha --recursive tests", "jtest": "jest --detectOpenHandles", "build-admin": "npm run build-admin:css && npm run build-admin:main && npm run build-admin:lamassu", - "server": "nodemon bin/lamassu-server --mockSms", - "admin-server": "nodemon bin/lamassu-admin-server --dev", + "server": "nodemon bin/lamassu-server --mockSms --logLevel silly", + "admin-server": "nodemon bin/lamassu-admin-server --dev --logLevel silly", "graphql-server": "nodemon bin/new-graphql-dev-insecure", "watch": "concurrently \"npm:server\" \"npm:admin-server\" \"npm:graphql-server\"", "stress-test": "cd ./test/stress/ && node index.js 50 -v"