mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-18 06:34:19 +01:00
Added Logger class; refactored logging accordingly
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from pisa import logging, M
|
||||
from pisa import Logger
|
||||
|
||||
logger = Logger("Cleaner")
|
||||
|
||||
# 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 +20,13 @@ class Cleaner:
|
||||
else:
|
||||
locator_uuid_map[locator].remove(uuid)
|
||||
|
||||
logging.info(M("[Cleaner] end time reached with no match! Deleting appointment.",
|
||||
locator=locator, uuid=uuid))
|
||||
logger.info("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(M("[Cleaner] job completed. Appointment ended after reaching enough confirmations.",
|
||||
uuid=uuid, height=height, confirmations=confirmations))
|
||||
logger.info("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 +35,7 @@ class Cleaner:
|
||||
if len(tx_job_map[justice_txid]) == 1:
|
||||
tx_job_map.pop(justice_txid)
|
||||
|
||||
logging.info(M("[Cleaner] no more jobs for justice transaction.", justice_txid=justice_txid))
|
||||
logger.info("no more jobs for justice transaction.", justice_txid=justice_txid)
|
||||
|
||||
else:
|
||||
tx_job_map[justice_txid].remove(uuid)
|
||||
|
||||
Reference in New Issue
Block a user