-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
good first issuehelp wantedp3-nice-to-haveIt should be done this or next sprintIt should be done this or next sprintperformanceimprovement over resource / time consuming tasksimprovement over resource / time consuming tasksrefactoringFactoring and re-factoringFactoring and re-factoring
Description
E.g.
logger.debug("Saving {} to {}.".format(path_info, to_info))
should be
logger.debug("Saving '%s' to '%s'.", path_info, to_info)
As suggested by @ei-grad in this PR: #1822
Reference: https://docs.python.org/3/howto/logging.html#optimization
It needs to support braces {} formatting, you can use a log adapter for Python 2.7:
```python
import logging
class Message(object):
def init(self, fmt, args):
self.fmt = fmt
self.args = args
def __str__(self):
return self.fmt.format(*self.args)
class StyleAdapter(logging.LoggerAdapter):
def init(self, logger, extra=None):
super(StyleAdapter, self).init(logger, extra or {})
def log(self, level, msg, *args, **kwargs):
if self.isEnabledFor(level):
msg, kwargs = self.process(msg, kwargs)
self.logger._log(level, Message(msg, args), (), **kwargs)
efiop
Metadata
Metadata
Assignees
Labels
good first issuehelp wantedp3-nice-to-haveIt should be done this or next sprintIt should be done this or next sprintperformanceimprovement over resource / time consuming tasksimprovement over resource / time consuming tasksrefactoringFactoring and re-factoringFactoring and re-factoring