Ejemplo n.º 1
0
def _initialize_logger() -> 'LoggerWithVerbose':
    import logging
    from .util.logging import _LoggerWithVerbose, log_verbose

    try:
        # noinspection PyPackageRequirements
        import google

        # This method is undocumented, but is required to read large size of model files when using
        # the C++ implementation.
        # noinspection PyPackageRequirements,PyUnresolvedReferences,PyProtectedMember
        from google.protobuf.pyext import _message
        _message.SetAllowOversizeProtos(True)

    except ImportError:
        pass

    original_logger = logging.getLoggerClass()

    class CombinedLogger(original_logger, _LoggerWithVerbose):
        pass

    logging.setLoggerClass(CombinedLogger)
    dazl_logger = logging.getLogger('dazl')
    if not hasattr(dazl_logger, 'verbose'):
        from functools import partial
        dazl_logger.verbose = partial(log_verbose, dazl_logger)
    logging.setLoggerClass(original_logger)
    return dazl_logger
Ejemplo n.º 2
0
    exercise_by_key,
)
from .ledger import Command
from .ledger.grpc import connect
from .model.core import ContractId
from .pretty.table import write_acs
from .prim import ContractData, DazlError, FrozenDict as frozendict, Party
from .util.logging import setup_default_logger

try:
    # This method is undocumented, but is required to read large size of model files when using
    # the C++ implementation.
    # noinspection PyPackageRequirements,PyUnresolvedReferences,PyProtectedMember
    from google.protobuf.pyext import _message

    _message.SetAllowOversizeProtos(True)

except ImportError:
    # ImportError for the Protobuf libraries is likely fatal, but this would not be the most helpful
    # place to throw an ImportError.
    pass


def _get_version() -> str:
    """
    Used to make the version of this library easily accessible programmatically.
    Two techniques are tried:
     1. Try to read it from the current package definition. This is what is used
        when trying to look up version information if dazl is installed via a
        wheel file.
     2. Use the value from the local pyproject.toml file (this is used when