From c1a007af282091be343fddb255f79a0b1d490d37 Mon Sep 17 00:00:00 2001 From: harisang Date: Wed, 3 May 2023 12:45:28 +0300 Subject: [PATCH] logs editing --- src/daemon.py | 6 +++--- src/off_chain/cow_endpoint_surplus.py | 30 +++++++++++++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/daemon.py b/src/daemon.py index 082e6f3..2a72975 100644 --- a/src/daemon.py +++ b/src/daemon.py @@ -36,7 +36,7 @@ def main(self, sleep_time: int) -> None: infura_connection = f"https://mainnet.infura.io/v3/{INFURA_KEY}" web_3 = Web3(Web3.HTTPProvider(infura_connection)) start_block = web_3.eth.block_number - self.logger.info("starting...") + # self.logger.info("starting...") unchecked_hashes: List[str] = [] while True: time.sleep(sleep_time) @@ -52,11 +52,11 @@ def main(self, sleep_time: int) -> None: else: unchecked_hashes.append(single_hash) - self.logger.info("going to sleep...") + # self.logger.info("going to sleep...") start_block = end_block + 1 if __name__ == "__main__": checker = DaemonEBBO() # sleep time can be set here in seconds - checker.main(600) + checker.main(300) diff --git a/src/off_chain/cow_endpoint_surplus.py b/src/off_chain/cow_endpoint_surplus.py index a48dbd6..b73c6b2 100644 --- a/src/off_chain/cow_endpoint_surplus.py +++ b/src/off_chain/cow_endpoint_surplus.py @@ -270,18 +270,26 @@ def logging_function( """ Logs to terminal (and file iff file_name is passed). """ - - self.logger.error( - "Transaction Hash: %s\nFor order: %s\nWinning Solver: %s\n" - "More surplus Corresponding Solver: %s\nDeviation: %s\n" - "absolute difference: %s\n", - competition_data["transactionHash"], - individual_order_id, - solver, - competition_data["solutions"][first_key]["solver"], - str(format(sorted_values[0][1], ".4f")) + "%", - str(format(sorted_values[0][0], ".5f")) + " ETH", + log_output = ( + "Transaction Hash: " + + competition_data["transactionHash"] + + "\n" + + "Order: " + + individual_order_id + + "\n" + + "Winning Solver: " + + solver + + "\n" + + "More surplus Corresponding Solver: " + + competition_data["solutions"][first_key]["solver"] + + "\n" + + "Deviation: " + + (str(format(sorted_values[0][1], ".4f")) + "%") + + "\n" + + "Absolute difference: " + + (str(format(sorted_values[0][0], ".5f")) + " ETH\n") ) + self.logger.error(log_output) def statistics_output(self, start_block: int, end_block: int) -> None: """