Modify variable's usage 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: If8d36220a9370b304ae51a329f8bba370285fdc2
This commit is contained in:
chenaidong1 2016-12-06 15:35:07 +08:00
parent b07473d388
commit 155f747a66

View File

@ -367,7 +367,7 @@ def main():
CONF.set_default('use_stderr', False)
logging.setup(CONF, 'murano')
except RuntimeError as e:
LOG.exception(_LE("Failed to initialize murano-test-runner: %s") % e)
LOG.exception(_LE("Failed to initialize murano-test-runner: %s"), e)
sys.exit("ERROR: %s" % e)
try: