Modify variable's using method in Log Messages

String interpolation should be delayed to be handled by the logging code, 
rather than being done at the point of the logging call. 
Ref:http://docs.openstack.org/developer/oslo.i18n/guidelines.html#log-translation
For example:
# WRONG
LOG.info(_LI('some message: variable=%s') % variable)
# RIGHT
LOG.info(_LI('some message: variable=%s'), variable)

Change-Id: I77c9b9783c623167ada1631cf05bf4cf4c40e6b1
This commit is contained in:
zhangyanxian 2016-11-07 01:59:22 +00:00
parent 549b1ce29d
commit 4ced93b005
1 changed files with 1 additions and 1 deletions

View File

@ -73,7 +73,7 @@ def cert_rotation():
"""Perform certificate rotation."""
interval = CONF.house_keeping.cert_interval
LOG.info(
_LI("Expiring certificate check interval is set to %d sec") % interval)
_LI("Expiring certificate check interval is set to %d sec"), interval)
cert_rotate = house_keeping.CertRotation()
while cert_rotate_thread_event.is_set():
LOG.debug("Initiating certification rotation ...")