Skip to content

Commit

Permalink
use logging lib
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardo-gnosis committed Sep 10, 2024
1 parent dc8b07a commit 6484971
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/api/routes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

from flask import Blueprint, current_app, jsonify, request
from web3 import Web3

Expand Down Expand Up @@ -69,7 +71,7 @@ def _ask(request_data, request_headers, validate_captcha=True, validate_csrf=Tru
try:
# convert recipient address to checksum address
recipient = Web3.to_checksum_address(validator.recipient)
print(f"will try to send {amount_wei} to {recipient}")
logging.info(f'will try to send {amount_wei} to {recipient}')

w3 = Web3Singleton(current_app.config['FAUCET_RPC_URL'],
current_app.config['FAUCET_PRIVATE_KEY'])
Expand All @@ -79,13 +81,13 @@ def _ask(request_data, request_headers, validate_captcha=True, validate_csrf=Tru
current_app.config['FAUCET_ADDRESS'],
recipient,
amount_wei)
print(f"native token txn: {tx_hash}")
logging.info(f'native token txn: {tx_hash}')
else:
tx_hash = claim_token(w3, current_app.config['FAUCET_ADDRESS'],
recipient,
amount_wei,
validator.token.address)
print(f"token with address txn: {validator.token.address}")
logging.info(f'token with address {validator.token.address} txn: {tx_hash}')

# save transaction data on DB
transaction = Transaction()
Expand Down

0 comments on commit 6484971

Please sign in to comment.