Only set base logging from entrypoints
This commit is contained in:
parent
dec628b7a9
commit
f705a85b5c
4
cli.py
4
cli.py
@ -1,4 +1,6 @@
|
|||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
@ -8,6 +10,8 @@ from mev_inspect.inspector import MEVInspector
|
|||||||
|
|
||||||
RPC_URL_ENV = "RPC_URL"
|
RPC_URL_ENV = "RPC_URL"
|
||||||
|
|
||||||
|
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def cli():
|
def cli():
|
||||||
|
@ -16,7 +16,7 @@ from mev_inspect.provider import get_base_provider
|
|||||||
from mev_inspect.signal_handler import GracefulKiller
|
from mev_inspect.signal_handler import GracefulKiller
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(filename="listener.log", level=logging.INFO)
|
logging.basicConfig(filename="listener.log", filemode="a", level=logging.INFO)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# lag to make sure the blocks we see are settled
|
# lag to make sure the blocks we see are settled
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
@ -14,8 +12,6 @@ from mev_inspect.schemas.traces import Trace, TraceType
|
|||||||
from mev_inspect.utils import hex_to_int
|
from mev_inspect.utils import hex_to_int
|
||||||
|
|
||||||
|
|
||||||
cache_directory = "./cache"
|
|
||||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -171,17 +167,3 @@ def get_transaction_hashes(calls: List[Trace]) -> List[str]:
|
|||||||
result.append(call.transaction_hash)
|
result.append(call.transaction_hash)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def cache_block(cache_path: Path, block: Block):
|
|
||||||
write_mode = "w" if cache_path.is_file() else "x"
|
|
||||||
|
|
||||||
cache_path.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
with open(cache_path, mode=write_mode) as cache_file:
|
|
||||||
cache_file.write(block.json())
|
|
||||||
|
|
||||||
|
|
||||||
def _get_cache_path(block_number: int) -> Path:
|
|
||||||
cache_directory_path = Path(cache_directory)
|
|
||||||
return cache_directory_path / f"{block_number}.json"
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
import traceback
|
import traceback
|
||||||
from asyncio import CancelledError
|
from asyncio import CancelledError
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -14,7 +13,6 @@ from mev_inspect.classifiers.trace import TraceClassifier
|
|||||||
from mev_inspect.inspect_block import inspect_block
|
from mev_inspect.inspect_block import inspect_block
|
||||||
from mev_inspect.provider import get_base_provider
|
from mev_inspect.provider import get_base_provider
|
||||||
|
|
||||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
import sys
|
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
Callable,
|
||||||
@ -39,7 +38,6 @@ aiohttp_exceptions = (
|
|||||||
ClientResponseError,
|
ClientResponseError,
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user