Thank you for the quick responses!
My understanding from the latest python documentation is that '.format' supersedes the use of '%'. Therefore, it seemed a little strange that the Landscape configuration was advising the use of '%', which is why I asked the question. I understand having a check in to ensure consistency but I would have expected it to be checking that '.format' is being used, not '%'. I would not be against Jeremiah's suggestion of disabling this warning. If no-one has any strong objections, we will go ahead and make the change then create a PR. Cheers, Luke Maycock OLIVER WYMAN [email protected]<mailto:[email protected]> www.oliverwyman.com<http://www.oliverwyman.com/> ________________________________ From: Jeremiah Lowin <[email protected]> Sent: 17 October 2016 15:23 To: [email protected] Cc: Maycock, Luke Subject: Re: String formatting Indeed -- though I think the larger question from Luke is whether or not we want to enforce a certain style of logging message (variable arguments vs formatting the string itself). Since there's nothing to stop users from formatting the string on one line and passing it to logging on the next, not to mention that I don't really see the performance benefit, I think this warning is silly and should be removed and people can log however they feel most comfortable. Just my $0.02. On Mon, Oct 17, 2016 at 10:20 AM Andrew Phillips <[email protected]> wrote: > Perhaps I stand corrected! -- though I don't see where it actually says > this approach is preferred. In any case, the Python 3 docs explicitly > state > that the behavior is only maintained for backwards compatibility: > https://docs.python.org/3/howto/logging.html#logging-variable-data Ah, interesting! From [1], it appears that it's now possible to change the placeholder syntax so that the messages look somewhat more "modern". As far as I can tell, variable components of the log messages are still intended to be passed as arguments, though? So with the style change, the log message could look like this: logging.info("A message with a param: {}", param) Regards ap [1] https://docs.python.org/3/howto/logging-cookbook.html#formatting-styles ________________________________ This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your cooperation.
