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
On Mon, Oct 17, 2016 at 10:10 AM Andrew Phillips <[email protected]> wrote: > > "Use % formatting in logging functions and pass the % parameters as > > arguments" > > > > [...] > > > > Can anybody give a judgement on this? If the .format is preferred, > > then we'll look into changing the landscape.io settings. > > As far as I can tell from the Python 2 logging docs [1] at least, the > following is indeed the preferred approach: > > logging.info("Some message with a param: %s", param) > > One of the reasons is that the string representation of param does not > need to be evaluated if the framework can determine that info logging is > not enabled - this differs from using format, where the string has to be > calculated irrespective of whether it is ever emitted. > > Regards > > ap > > [1] https://docs.python.org/2/library/logging.html >
