Skip to content

Commit

Permalink
revert config setting name; add more logging
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Whitehead <cywolf@gmail.com>
  • Loading branch information
andrewwhitehead committed Jul 16, 2019
1 parent fc8e341 commit fb54120
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aries_cloudagent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main():

# Set up logging
log_config = settings.get("log.config")
log_level = settings.get("log_level") or os.getenv("LOG_LEVEL")
log_level = settings.get("log.level") or os.getenv("LOG_LEVEL")
LoggingConfigurator.configure(log_config, log_level)

# Fetch genesis transactions if necessary
Expand Down
2 changes: 1 addition & 1 deletion aries_cloudagent/config/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def get_settings(args):
if args.log_config:
settings["log.config"] = args.log_config
if args.log_level:
settings["log_level"] = args.log_level
settings["log.level"] = args.log_level

settings["transport.inbound_configs"] = args.inbound_transports
settings["transport.outbound_configs"] = args.outbound_transports
Expand Down
7 changes: 5 additions & 2 deletions aries_cloudagent/messaging/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from ...classloader import ClassLoader
from ...error import BaseError

LOGGER = logging.getLogger(__name__)


def resolve_class(the_cls, relative_cls: type = None):
"""
Expand Down Expand Up @@ -124,8 +126,7 @@ def deserialize(cls, obj):
try:
return schema.loads(obj) if isinstance(obj, str) else schema.load(obj)
except ValidationError as e:
logger = logging.getLogger(__name__)
logger.debug('message validation error: %s', e)
LOGGER.exception("Message validation error:")
raise BaseModelError("Schema validation failed") from e

def serialize(self, as_string=False) -> dict:
Expand All @@ -143,6 +144,7 @@ def serialize(self, as_string=False) -> dict:
try:
return schema.dumps(self) if as_string else schema.dump(self)
except ValidationError as e:
LOGGER.exception("Message serialization error:")
raise BaseModelError("Schema validation failed") from e

@classmethod
Expand All @@ -160,6 +162,7 @@ def from_json(cls, json_repr: Union[str, bytes]):
try:
parsed = json.loads(json_repr)
except ValueError as e:
LOGGER.exception("Message parse error:")
raise BaseModelError("JSON parsing failed") from e
return cls.deserialize(parsed)

Expand Down

0 comments on commit fb54120

Please sign in to comment.