Skip to content

replaced old string formatting with new everywhere except in logging

Jonas Eschle requested to merge 17-move-to-new-string-formatting into master

All strings containing %s/%j etc have been replaced with the .format() style except in logging.

Logging The point is that loggers do still only support old-style formatting. The passed arguments will be used to format the string, but only if the logger level requires it to do so. An alternative would be to pre-format the string and pass the fully formatted string to the logger, which is slightly slower (although negligible) as the string gets formatted every time anyway (even if the logger level does not require it to do so) and it blocks the possibility for other logging-formatters to access the logging arguments. Until this changes in python (new-style is allowed in logging), I would still stick to the old-but-correct way. But I do not have strong preferences towards this, we can also directly invoke .format.

Note: { is escaped by doubling (therefore, sometimes there is {{{}}}, which was {%s})

Closes #17 (closed)

Merge request reports