Skip to content

Commit

Permalink
Ease up on the default logging to stdout. Log to stdout for tests and…
Browse files Browse the repository at this point in the history
… scripts only.
  • Loading branch information
derekpierre committed Feb 23, 2024
1 parent 4c91ecb commit 5853241
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 1 addition & 8 deletions atxm/logging.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import sys

from twisted.logger import Logger, textFileLogObserver, globalLogPublisher
from twisted.logger import Logger

log = Logger("AutomaticTxMachine")


observer = textFileLogObserver(sys.stdout)

globalLogPublisher.addObserver(observer)
5 changes: 5 additions & 0 deletions examples/retrytx.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import sys

from eth_account import Account
from twisted.internet import reactor
from twisted.logger import globalLogPublisher, textFileLogObserver
from web3 import Web3, HTTPProvider
from web3.middleware import geth_poa_middleware

Expand All @@ -12,6 +14,9 @@
# Configuration
#

observer = textFileLogObserver(sys.stdout)
globalLogPublisher.addObserver(observer)

CHAIN_ID = 80001

ENDPOINT = os.environ["WEB3_PROVIDER_URI"]
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import sys

import pytest
from eth_account import Account
from twisted.internet.task import Clock
from twisted.logger import globalLogPublisher, textFileLogObserver

from atxm import AutomaticTxMachine
from atxm.logging import log

observer = textFileLogObserver(sys.stdout)
globalLogPublisher.addObserver(observer)

log.debug("Running tests")


Expand Down

0 comments on commit 5853241

Please sign in to comment.