Fixes logs and removes redundant tailing dots

This commit is contained in:
Sergi Delgado Segura
2019-12-16 19:45:30 +01:00
parent a9df67d787
commit 1184b4648a
7 changed files with 68 additions and 62 deletions

View File

@@ -30,7 +30,7 @@ class BlockProcessor:
except JSONRPCException as e:
block = None
logger.error("Couldn't get block from bitcoind.", error=e.error)
logger.error("Couldn't get block from bitcoind", error=e.error)
return block
@@ -50,7 +50,7 @@ class BlockProcessor:
except JSONRPCException as e:
block_hash = None
logger.error("Couldn't get block hash.", error=e.error)
logger.error("Couldn't get block hash", error=e.error)
return block_hash
@@ -94,7 +94,7 @@ class BlockProcessor:
except JSONRPCException as e:
tx = None
logger.error("Can't build transaction from decoded data.", error=e.error)
logger.error("Can't build transaction from decoded data", error=e.error)
return tx

View File

@@ -97,7 +97,7 @@ class Carrier:
else:
# If something else happens (unlikely but possible) log it so we can treat it in future releases
logger.error("JSONRPCException.", method="Carrier.send_transaction", error=e.error)
logger.error("JSONRPCException", method="Carrier.send_transaction", error=e.error)
receipt = Receipt(delivered=False, reason=UNKNOWN_JSON_RPC_EXCEPTION)
return receipt
@@ -129,6 +129,6 @@ class Carrier:
else:
# If something else happens (unlikely but possible) log it so we can treat it in future releases
logger.error("JSONRPCException.", method="Carrier.get_transaction", error=e.error)
logger.error("JSONRPCException", method="Carrier.get_transaction", error=e.error)
return tx_info

View File

@@ -37,7 +37,7 @@ class Cleaner:
else:
locator_uuid_map[locator].remove(uuid)
logger.info("End time reached with no breach. Deleting appointment.", locator=locator, uuid=uuid)
logger.info("End time reached with no breach. Deleting appointment", locator=locator, uuid=uuid)
# Delete appointment from the db
db_manager.delete_watcher_appointment(uuid)
@@ -92,7 +92,7 @@ class Cleaner:
for uuid, confirmations in completed_trackers:
logger.info(
"Appointment completed. Appointment ended after reaching enough confirmations.",
"Appointment completed. Appointment ended after reaching enough confirmations",
uuid=uuid,
height=height,
confirmations=confirmations,
@@ -105,7 +105,7 @@ class Cleaner:
if len(tx_tracker_map[penalty_txid]) == 1:
tx_tracker_map.pop(penalty_txid)
logger.info("No more trackers for penalty transaction.", penalty_txid=penalty_txid)
logger.info("No more trackers for penalty transaction", penalty_txid=penalty_txid)
else:
tx_tracker_map[penalty_txid].remove(uuid)
@@ -126,7 +126,7 @@ class Cleaner:
db_manager.store_update_locator_map(locator, locator_map)
else:
logger.error("UUID not found in the db.", uuid=uuid)
logger.error("UUID not found in the db", uuid=uuid)
else:
logger.error("Locator not found in the db.", uuid=uuid)
logger.error("Locator not found in the db", uuid=uuid)

View File

@@ -211,7 +211,7 @@ class Responder:
# TODO: Add the missing reasons (e.g. RPC_VERIFY_REJECTED)
# TODO: Use self.on_sync(block_hash) to check whether or not we failed because we are out of sync
logger.warning(
"Tracker cannot be created.", reason=receipt.reason, uuid=uuid, on_sync=self.on_sync(block_hash)
"Tracker cannot be created", reason=receipt.reason, uuid=uuid, on_sync=self.on_sync(block_hash)
)
pass
@@ -255,7 +255,7 @@ class Responder:
self.db_manager.store_responder_tracker(uuid, tracker.to_json())
logger.info(
"New tracker added.", dispute_txid=dispute_txid, penalty_txid=penalty_txid, appointment_end=appointment_end
"New tracker added", dispute_txid=dispute_txid, penalty_txid=penalty_txid, appointment_end=appointment_end
)
if self.asleep:
@@ -436,7 +436,7 @@ class Responder:
for uuid in self.tx_tracker_map[txid]:
tracker = self.trackers[uuid]
logger.warning(
"Transaction has missed many confirmations. Rebroadcasting.", penalty_txid=tracker.penalty_txid
"Transaction has missed many confirmations. Rebroadcasting", penalty_txid=tracker.penalty_txid
)
receipt = carrier.send_transaction(tracker.penalty_rawtx, tracker.penalty_txid)
@@ -444,7 +444,7 @@ class Responder:
if not receipt.delivered:
# FIXME: Can this actually happen?
logger.warning("Transaction failed.", penalty_txid=tracker.penalty_txid)
logger.warning("Transaction failed", penalty_txid=tracker.penalty_txid)
return receipts
@@ -475,7 +475,7 @@ class Responder:
self.unconfirmed_txs.append(tracker.penalty_txid)
logger.info(
"Penalty transaction back in mempool. Updating unconfirmed transactions.",
"Penalty transaction back in mempool. Updating unconfirmed transactions",
penalty_txid=tracker.penalty_txid,
)
@@ -502,5 +502,5 @@ class Responder:
# ToDo: #24-properly-handle-reorgs
# FIXME: if the dispute is not on chain (either in mempool or not there at all), we need to call the
# reorg manager
logger.warning("Dispute and penalty transaction missing. Calling the reorg manager.")
logger.error("Reorg manager not yet implemented.")
logger.warning("Dispute and penalty transaction missing. Calling the reorg manager")
logger.error("Reorg manager not yet implemented")

View File

@@ -139,7 +139,7 @@ class Watcher:
appointment_added = True
logger.info("New appointment accepted.", locator=appointment.locator)
logger.info("New appointment accepted", locator=appointment.locator)
signature = Cryptographer.sign(Cryptographer.signature_format(appointment.to_dict()), self.signing_key)
@@ -147,7 +147,7 @@ class Watcher:
appointment_added = False
signature = None
logger.info("Maximum appointments reached, appointment rejected.", locator=appointment.locator)
logger.info("Maximum appointments reached, appointment rejected", locator=appointment.locator)
return appointment_added, signature
@@ -177,7 +177,7 @@ class Watcher:
if block is not None:
txids = block.get("tx")
logger.info("List of transactions.", txids=txids)
logger.info("List of transactions", txids=txids)
expired_appointments = [
uuid
@@ -195,7 +195,7 @@ class Watcher:
# Errors decrypting the Blob will result in a None penalty_txid
if filtered_breach["valid_breach"] is True:
logger.info(
"Notifying responder and deleting appointment.",
"Notifying responder and deleting appointment",
penalty_txid=filtered_breach["penalty_txid"],
locator=filtered_breach["locator"],
uuid=uuid,
@@ -287,7 +287,7 @@ class Watcher:
penalty_txid = penalty_tx.get("txid")
valid_breach = True
logger.info("Breach found for locator.", locator=locator, uuid=uuid, penalty_txid=penalty_txid)
logger.info("Breach found for locator", locator=locator, uuid=uuid, penalty_txid=penalty_txid)
else:
penalty_txid = None