[openstack-dev] [OpenStack-Dev] Logging formats and i18n

John Griffith john.griffith8 at gmail.com
Mon Dec 22 15:42:09 UTC 2014


Lately (on the Cinder team at least) there's been a lot of
disagreement in reviews regarding the proper way to do LOG messages
correctly.  Use of '%' vs ',' in the formatting of variables etc.

We do have the oslo i18n guidelines page here [1], which helps a lot
but there's some disagreement on a specific case here.  Do we have a
set answer on:

LOG.info(_LI('some message: v1=%(v1)s v2=%(v2)s') % {'v1': v1, 'v2': v2})

vs

LOG.info(_LI('some message: v1=%(v1)s v2=%(v2)s'), {'v1': v1, 'v2': v2})


It's always fun when one person provides a -1 for the first usage; the
submitter changes it and another reviewer gives a -1 and says, no it
should be the other way.

I'm hoping maybe somebody on the olso team can provide an
authoritative answer and we can then update the example page
referenced in [1] to clarify this particular case.

Thanks,
John

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html



More information about the OpenStack-dev mailing list