Skip to content

Commit

Permalink
Merge pull request #26 from njgheorghita/logging
Browse files Browse the repository at this point in the history
Add logs to linker
  • Loading branch information
njgheorghita committed Nov 19, 2018
2 parents d43c544 + 4bbcb56 commit 0ce4eae
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pytest_ethereum/linker.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import logging
from typing import Any, Callable, Dict, Tuple

import cytoolz
from eth_utils import to_canonical_address, to_hex
from eth_utils import to_canonical_address, to_checksum_address, to_hex
from eth_utils.toolz import assoc_in, pipe

from ethpm import Package
from ethpm.typing import Address

from pytest_ethereum._utils.linker import (
create_deployment_data,
create_latest_block_uri,
Expand All @@ -14,6 +15,8 @@
)
from pytest_ethereum.exceptions import LinkerError

logger = logging.getLogger("pytest_ethereum.linker")


def linker(*args: Callable[..., Any]) -> Callable[..., Any]:
return _linker(args)
Expand Down Expand Up @@ -60,6 +63,7 @@ def _deploy(
manifest = insert_deployment(
package, contract_name, deployment_data, latest_block_uri
)
logger.info("%s deployed." % contract_name)
return Package(manifest, package.w3)


Expand All @@ -83,6 +87,10 @@ def link(contract: str, linked_type: str, package: Package) -> Package:
("contract_types", contract, "deployment_bytecode", "bytecode"),
to_hex(linked_factory.bytecode),
)
logger.info(
"%s linked to %s at address %s."
% (contract, linked_type, to_checksum_address(deployment_address))
)
return Package(manifest, package.w3)


Expand All @@ -93,4 +101,5 @@ def run_python(callback_fn: Callable[..., None], package: Package) -> Package:
the contracts in the package.
"""
callback_fn(package)
logger.info("%s python function ran." % callback_fn.__name__)
return package

0 comments on commit 0ce4eae

Please sign in to comment.