Update logging messages

Change-Id: I33be28339b0f86472aafb85f53c8adb17c9ceece
This commit is contained in:
Mike Fedosin 2017-09-05 23:23:22 +03:00
parent ef89cae691
commit c1ed166a38
3 changed files with 18 additions and 10 deletions

View File

@ -158,10 +158,8 @@ def create_or_update(context, artifact_id, values, session):
artifact.activated_at = timeutils.utcnow()
artifact.update(values)
LOG.debug('Sending request to the database. '
'New values are %s', values)
artifact.save(session=session)
LOG.debug('Response from the database was received.')
LOG.debug("Response from the database was received.")
return artifact.to_dict()

View File

@ -94,11 +94,11 @@ class LockEngine(object):
"""
if lock_key is not None and len(lock_key) < self.MAX_LOCK_LENGTH:
lock_id = self.lock_api.create_lock(context, lock_key)
LOG.info("Lock %(lock_id)s acquired for lock_key %(lock_key)s",
{'lock_id': lock_id, 'lock_key': lock_key})
LOG.debug("Lock %(lock_id)s acquired for lock_key %(lock_key)s",
{'lock_id': lock_id, 'lock_key': lock_key})
else:
lock_id = None
LOG.info("No lock for lock_key %s", lock_key)
LOG.debug("No lock for lock_key %s", lock_key)
return Lock(context, lock_id, lock_key, self.release)
@ -109,5 +109,5 @@ class LockEngine(object):
"""
if lock.lock_id is not None:
self.lock_api.delete_lock(lock.context, lock.lock_id)
LOG.info("Lock %(lock_id)s released for lock_key %(key)s",
{'lock_id': lock.lock_id, 'key': lock.lock_key})
LOG.debug("Lock %(lock_id)s released for lock_key %(key)s",
{'lock_id': lock.lock_id, 'key': lock.lock_key})

View File

@ -253,6 +253,11 @@ Possible values:
"""
values = self.obj_changes_to_primitive()
values['type_name'] = self.get_type_name()
LOG.debug("Sending request to create artifact of type '%(type_name)s'."
" New values are %(values)s",
{'type_name': self.get_type_name(), 'values': values})
af_vals = self.db_api.save(context, None, values)
return self.init_artifact(context, af_vals)
@ -262,8 +267,13 @@ Possible values:
:param context: user context
:return: updated artifact object
"""
updated_af = self.db_api.save(context, self.id,
self.obj_changes_to_primitive())
values = self.obj_changes_to_primitive()
LOG.debug("Sending request to update artifact '%(af_id)s'. "
"New values are %(values)s",
{'af_id': self.id, 'values': values})
updated_af = self.db_api.save(context, self.id, values)
return self.init_artifact(context, updated_af)
@classmethod