Changed log format to JSON; fixed missing return value in get_potential_matches

This commit is contained in:
Salvatore Ingala
2019-10-08 16:32:09 +07:00
parent 1b229cb441
commit ed0cb4f632
11 changed files with 87 additions and 85 deletions

View File

@@ -1,4 +1,4 @@
from pisa import logging
from pisa import logging, M
# Dictionaries in Python are "passed-by-reference", so no return is needed for the Cleaner"
# https://docs.python.org/3/faq/programming.html#how-do-i-write-a-function-with-output-parameters-call-by-reference
@@ -18,14 +18,13 @@ class Cleaner:
else:
locator_uuid_map[locator].remove(uuid)
logging.info("[Cleaner] end time reached with no match! Deleting appointment {} (uuid: {})".format(locator,
uuid))
logging.info(M("[Cleaner] end time reached with no match! Deleting appointment.", locator=locator, uuid=uuid))
@staticmethod
def delete_completed_jobs(jobs, tx_job_map, completed_jobs, height):
for uuid, confirmations in completed_jobs:
logging.info("[Cleaner] job completed (uuid = {}). Appointment ended at block {} after {} confirmations"
.format(uuid, height, confirmations))
logging.info(M("[Cleaner] job completed. Appointment ended after reaching enough confirmations.",
uuid=uuid, height=height, confirmations=confirmations))
# ToDo: #9-add-data-persistence
justice_txid = jobs[uuid].justice_txid
@@ -34,7 +33,7 @@ class Cleaner:
if len(tx_job_map[justice_txid]) == 1:
tx_job_map.pop(justice_txid)
logging.info("[Cleaner] no more jobs for justice_txid {}".format(justice_txid))
logging.info(M("[Cleaner] no more jobs for justice transaction.", justice_txid=justice_txid))
else:
tx_job_map[justice_txid].remove(uuid)