summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2016-08-31 07:22:29 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2016-08-31 07:22:29 (GMT)
commitdd917f84e3775596049e09746f32053c50b3d422 (patch)
tree5b59a563c228493069bcf00e166fba7cea8ebfef /Doc
parentee47e5cf8ad0e52e2c5291662b9b15c2ba8848ea (diff)
downloadcpython-dd917f84e3775596049e09746f32053c50b3d422.zip
cpython-dd917f84e3775596049e09746f32053c50b3d422.tar.gz
cpython-dd917f84e3775596049e09746f32053c50b3d422.tar.bz2
Closes #27904: Improved logging statements to defer formatting until needed.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/contextlib.rst4
-rw-r--r--Doc/library/shutil.rst2
-rw-r--r--Doc/library/typing.rst2
-rw-r--r--Doc/whatsnew/3.2.rst4
4 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
index 810cea8..dd34c96 100644
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -590,10 +590,10 @@ single definition::
self.name = name
def __enter__(self):
- logging.info('Entering: {}'.format(self.name))
+ logging.info('Entering: %s', self.name)
def __exit__(self, exc_type, exc, exc_tb):
- logging.info('Exiting: {}'.format(self.name))
+ logging.info('Exiting: %s', self.name)
Instances of this class can be used as both a context manager::
diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst
index a1cf241..fefd6ab 100644
--- a/Doc/library/shutil.rst
+++ b/Doc/library/shutil.rst
@@ -425,7 +425,7 @@ Another example that uses the *ignore* argument to add a logging call::
import logging
def _logpath(path, names):
- logging.info('Working in %s' % path)
+ logging.info('Working in %s', path)
return [] # nothing will be ignored
copytree(source, destination, ignore=_logpath)
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index 3eaf166..d902a15 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -204,7 +204,7 @@ A user-defined class can be defined as a generic class.
return self.value
def log(self, message: str) -> None:
- self.logger.info('{}: {}'.format(self.name, message))
+ self.logger.info('%s: %s', self.name, message)
``Generic[T]`` as a base class defines that the class ``LoggedVar`` takes a
single type parameter ``T`` . This also makes ``T`` valid as a type within the
diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst
index 9f3584d..3d237ea 100644
--- a/Doc/whatsnew/3.2.rst
+++ b/Doc/whatsnew/3.2.rst
@@ -1253,9 +1253,9 @@ definition::
@contextmanager
def track_entry_and_exit(name):
- logging.info('Entering: {}'.format(name))
+ logging.info('Entering: %s', name)
yield
- logging.info('Exiting: {}'.format(name))
+ logging.info('Exiting: %s', name)
Formerly, this would have only been usable as a context manager::