feat: add extra (optional) logging

This commit is contained in:
André Sá 2022-03-09 16:23:17 +00:00
parent 348260931e
commit 288920b927
3 changed files with 10 additions and 2 deletions

View file

@ -28,6 +28,7 @@ end`
module.exports = {post, monitorPending, cancel, PENDING_INTERVAL, TRANSACTION_STATES} module.exports = {post, monitorPending, cancel, PENDING_INTERVAL, TRANSACTION_STATES}
function post (machineTx, pi) { function post (machineTx, pi) {
logger.silly('Updating cashin tx:', machineTx)
return cashInAtomic.atomic(machineTx, pi) return cashInAtomic.atomic(machineTx, pi)
.then(r => { .then(r => {
const updatedTx = r.tx const updatedTx = r.tx

View file

@ -37,6 +37,7 @@ function selfPost (tx, pi) {
} }
function post (tx, pi, fromClient = true) { function post (tx, pi, fromClient = true) {
logger.silly('Updating cashout tx:', tx)
return cashOutAtomic.atomic(tx, pi, fromClient) return cashOutAtomic.atomic(tx, pi, fromClient)
.then(txVector => { .then(txVector => {
const [, newTx, justAuthorized] = txVector const [, newTx, justAuthorized] = txVector
@ -57,7 +58,13 @@ function postProcess (txVector, justAuthorized, pi) {
if ((newTx.dispense && !oldTx.dispense) || (newTx.redeem && !oldTx.redeem)) { if ((newTx.dispense && !oldTx.dispense) || (newTx.redeem && !oldTx.redeem)) {
return pi.buildAvailableCassettes(newTx.id) return pi.buildAvailableCassettes(newTx.id)
.then(cassettes => { .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) const bills = billMath.makeChange(cassettes.cassettes, newTx.fiat)
logger.silly('Bills to dispense:', bills)
if (!bills) throw httpError('Out of bills', INSUFFICIENT_FUNDS_CODE) if (!bills) throw httpError('Out of bills', INSUFFICIENT_FUNDS_CODE)
return bills return bills

View file

@ -119,8 +119,8 @@
"test": "mocha --recursive tests", "test": "mocha --recursive tests",
"jtest": "jest --detectOpenHandles", "jtest": "jest --detectOpenHandles",
"build-admin": "npm run build-admin:css && npm run build-admin:main && npm run build-admin:lamassu", "build-admin": "npm run build-admin:css && npm run build-admin:main && npm run build-admin:lamassu",
"server": "nodemon bin/lamassu-server --mockSms", "server": "nodemon bin/lamassu-server --mockSms --logLevel silly",
"admin-server": "nodemon bin/lamassu-admin-server --dev", "admin-server": "nodemon bin/lamassu-admin-server --dev --logLevel silly",
"graphql-server": "nodemon bin/new-graphql-dev-insecure", "graphql-server": "nodemon bin/new-graphql-dev-insecure",
"watch": "concurrently \"npm:server\" \"npm:admin-server\" \"npm:graphql-server\"", "watch": "concurrently \"npm:server\" \"npm:admin-server\" \"npm:graphql-server\"",
"stress-test": "cd ./test/stress/ && node index.js 50 -v" "stress-test": "cd ./test/stress/ && node index.js 50 -v"