From 92d4aa880a17772b0be29661db0b138f88d9c13d Mon Sep 17 00:00:00 2001 From: Uggla Date: Wed, 6 Apr 2016 13:46:58 +0200 Subject: [PATCH] Improve debug readability - Pretty print data returned, so humans can read them. - Cosmetic fixes. --- redfish/main.py | 3 --- redfish/types.py | 9 +++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/redfish/main.py b/redfish/main.py index a080129..9bdf5f0 100644 --- a/redfish/main.py +++ b/redfish/main.py @@ -205,9 +205,6 @@ class RedfishConnection(object): "this is insecure and can allow" + " a man in the middle attack") - # Show redfish standard headers - config.logger.debug(self.connection_parameters.headers) - config.logger.debug("Root url : %s", self.connection_parameters.rooturl) self.Root = types.Root(self.connection_parameters.rooturl, diff --git a/redfish/types.py b/redfish/types.py index 304117f..0ee1b35 100644 --- a/redfish/types.py +++ b/redfish/types.py @@ -32,7 +32,12 @@ class Base(object): self.url = url self.api_url = tortilla.wrap(url, debug=config.TORTILLADEBUG) - config.logger.debug(connection_parameters.headers) + config.logger.debug( + "------------------------------------------------------------") + config.logger.debug("Url: %s" % url) + config.logger.debug("Header: %s" % connection_parameters.headers) + config.logger.debug( + "------------------------------------------------------------") try: self.data = self.api_url.get( @@ -50,7 +55,7 @@ class Base(object): 'Ivalid content : Content does not appear to be a valid ' + \ 'Redfish json\n' raise exception.InvalidRedfishContentException(msg) - config.logger.debug(self.data) + config.logger.debug(pprint.PrettyPrinter(indent=4).pformat(self.data)) def get_link_url(self, link_type): '''Need to be explained.