From 3ec0e833eb98e3edd73c53332ff4d9d6296d7ce2 Mon Sep 17 00:00:00 2001 From: Peter Hamilton Date: Tue, 2 Jun 2015 09:02:57 -0400 Subject: [PATCH] Updating client and demo logging This change updates various logging statements for the KMIP client and demo suites, ensuring that the default logging level for the library is at the INFO level and that all demo logging is at the INFO level. --- kmip/__init__.py | 4 ++-- kmip/demos/units/create.py | 14 +++++++------- kmip/demos/units/destroy.py | 8 ++++---- kmip/demos/units/discover_versions.py | 14 +++++++------- kmip/demos/units/get.py | 10 +++++----- kmip/demos/units/locate.py | 10 +++++----- kmip/demos/units/register.py | 12 ++++++------ kmip/logconfig.ini | 4 ++-- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/kmip/__init__.py b/kmip/__init__.py index 08a7eac..9c80269 100644 --- a/kmip/__init__.py +++ b/kmip/__init__.py @@ -38,7 +38,7 @@ else: }, 'handlers': { 'consoleHandler': { - 'level': 'DEBUG', + 'level': 'INFO', 'class': 'logging.StreamHandler', 'formatter': 'simpleFormatter', 'stream': sys.stdout @@ -46,7 +46,7 @@ else: }, 'loggers': { 'root': { - 'level': 'DEBUG', + 'level': 'INFO', 'handlers': ['consoleHandler'] } } diff --git a/kmip/demos/units/create.py b/kmip/demos/units/create.py index 57a83a3..8a08cc1 100644 --- a/kmip/demos/units/create.py +++ b/kmip/demos/units/create.py @@ -121,17 +121,17 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('create() result status: {0}'.format( + logger.info('create() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('created object type: {0}'.format( + logger.info('created object type: {0}'.format( result.object_type.enum)) - logger.debug('created UUID: {0}'.format(result.uuid.value)) - logger.debug('created template attribute: {0}'. - format(result.template_attribute)) + logger.info('created UUID: {0}'.format(result.uuid.value)) + logger.info('created template attribute: {0}'. + format(result.template_attribute)) else: - logger.debug('create() result reason: {0}'.format( + logger.info('create() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('create() result message: {0}'.format( + logger.info('create() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/destroy.py b/kmip/demos/units/destroy.py index a88b7f6..3429060 100644 --- a/kmip/demos/units/destroy.py +++ b/kmip/demos/units/destroy.py @@ -72,13 +72,13 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('destroy() result status: {0}'.format( + logger.info('destroy() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('destroyed UUID: {0}'.format(result.uuid.value)) + logger.info('destroyed UUID: {0}'.format(result.uuid.value)) else: - logger.debug('destroy() result reason: {0}'.format( + logger.info('destroy() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('destroy() result message: {0}'.format( + logger.info('destroy() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/discover_versions.py b/kmip/demos/units/discover_versions.py index 402d268..ade4512 100644 --- a/kmip/demos/units/discover_versions.py +++ b/kmip/demos/units/discover_versions.py @@ -48,21 +48,21 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('discover_versions() result status: {0}'.format( + logger.info('discover_versions() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: protocol_versions = result.protocol_versions if isinstance(protocol_versions, list): - logger.debug('number of protocol versions returned: {0}'.format( + logger.info('number of protocol versions returned: {0}'.format( len(protocol_versions))) for protocol_version in protocol_versions: - logging.debug('protocol version supported: {0}'.format( - protocol_version)) + logger.info('protocol version supported: {0}'.format( + protocol_version)) else: - logger.debug('number of protocol versions returned: 0') + logger.info('number of protocol versions returned: 0') else: - logger.debug('discover_versions() result reason: {0}'.format( + logger.info('discover_versions() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('discover_versions() result message: {0}'.format( + logger.info('discover_versions() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/get.py b/kmip/demos/units/get.py index 0f8dc3d..7fba7cb 100644 --- a/kmip/demos/units/get.py +++ b/kmip/demos/units/get.py @@ -91,17 +91,17 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('get() result status: {0}'.format( + logger.info('get() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('retrieved object type: {0}'.format( + logger.info('retrieved object type: {0}'.format( result.object_type.enum)) - logger.debug('retrieved UUID: {0}'.format(result.uuid.value)) + logger.info('retrieved UUID: {0}'.format(result.uuid.value)) utils.log_secret(logger, result.object_type.enum, result.secret) else: - logger.debug('get() result reason: {0}'.format( + logger.info('get() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('get() result message: {0}'.format( + logger.info('get() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/locate.py b/kmip/demos/units/locate.py index 2aa1b17..858dbdb 100644 --- a/kmip/demos/units/locate.py +++ b/kmip/demos/units/locate.py @@ -87,15 +87,15 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('locate() result status: {0}'.format( + logger.info('locate() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('located UUIDs:') + logger.info('located UUIDs:') for uuid in result.uuids: - logging.debug('{0}'.format(uuid)) + logger.info('{0}'.format(uuid)) else: - logger.debug('get() result reason: {0}'.format( + logger.info('get() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('get() result message: {0}'.format( + logger.info('get() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/register.py b/kmip/demos/units/register.py index 7bc04e4..06fbf78 100644 --- a/kmip/demos/units/register.py +++ b/kmip/demos/units/register.py @@ -72,15 +72,15 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('register() result status: {0}'.format( + logger.info('register() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('registered UUID: {0}'.format(result.uuid.value)) - logger.debug('registered template attribute: {0}'. - format(result.template_attribute)) + logger.info('registered UUID: {0}'.format(result.uuid.value)) + logger.info('registered template attribute: {0}'. + format(result.template_attribute)) else: - logger.debug('register() result reason: {0}'.format( + logger.info('register() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('register() result message: {0}'.format( + logger.info('register() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/logconfig.ini b/kmip/logconfig.ini index ed4b825..32cf501 100644 --- a/kmip/logconfig.ini +++ b/kmip/logconfig.ini @@ -8,12 +8,12 @@ keys=consoleHandler keys=simpleFormatter [logger_root] -level=DEBUG +level=INFO handlers=consoleHandler [handler_consoleHandler] class=StreamHandler -level=DEBUG +level=INFO formatter=simpleFormatter args=(sys.stdout,)