Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off "Transaction Sent" logging #1687

Open
0xprofessooor opened this issue Apr 26, 2023 · 1 comment
Open

Turn off "Transaction Sent" logging #1687

0xprofessooor opened this issue Apr 26, 2023 · 1 comment

Comments

@0xprofessooor
Copy link

Overview

I would like to turn off the "Transaction Sent" log that gets printed to the console everytime a transaction is processed.

Specification

Ideally, this would be incorporated with the logging built-in package, where I can specify a logging level that disables all printing.

Dependencies

None

@vyash-natarajan
Copy link

vyash-natarajan commented Nov 26, 2023

You can use the built-in logging module.

`import logging

Configure the root logger

logging.basicConfig(level=logging.INFO) # Set the desired logging level

Get the logger for the Ethereum transaction module (replace 'eth_transaction' with the actual module name)

eth_transaction_logger = logging.getLogger('eth_transaction')

Set the log level for the Ethereum transaction logger to a higher level (e.g., WARNING) to suppress INFO messages

eth_transaction_logger.setLevel(logging.WARNING)

Example usage

def process_ethereum_transaction():
Your transaction processing logic here
Log a transaction message (this will be suppressed if the log level is set to WARNING or higher)
eth_transaction_logger.info('Transaction Sent')

Call your function to process Ethereum transactions

process_ethereum_transaction()
`

When you call the process_ethereum_transaction function, the log message "Transaction Sent" will only be printed if the log level is set to INFO or lower. If you set it to WARNING or higher, the message will be suppressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants