Improve debug readability

- Pretty print data returned, so humans can read them.
- Cosmetic fixes.
This commit is contained in:
Uggla 2016-04-06 13:46:58 +02:00
parent 45fdc2819e
commit 92d4aa880a
2 changed files with 7 additions and 5 deletions

View File

@ -205,9 +205,6 @@ class RedfishConnection(object):
"this is insecure and can allow" + "this is insecure and can allow" +
" a man in the middle attack") " a man in the middle attack")
# Show redfish standard headers
config.logger.debug(self.connection_parameters.headers)
config.logger.debug("Root url : %s", config.logger.debug("Root url : %s",
self.connection_parameters.rooturl) self.connection_parameters.rooturl)
self.Root = types.Root(self.connection_parameters.rooturl, self.Root = types.Root(self.connection_parameters.rooturl,

View File

@ -32,7 +32,12 @@ class Base(object):
self.url = url self.url = url
self.api_url = tortilla.wrap(url, debug=config.TORTILLADEBUG) 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: try:
self.data = self.api_url.get( self.data = self.api_url.get(
@ -50,7 +55,7 @@ class Base(object):
'Ivalid content : Content does not appear to be a valid ' + \ 'Ivalid content : Content does not appear to be a valid ' + \
'Redfish json\n' 'Redfish json\n'
raise exception.InvalidRedfishContentException(msg) 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): def get_link_url(self, link_type):
'''Need to be explained. '''Need to be explained.