Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c0eb43e

Browse files
muddi900jklymak
andauthored
added a note to avoid f-strings in logging (#25081)
* added a note to avoid f-strings in logging ------ Co-authored-by: Jody Klymak <[email protected]>
1 parent bdb4935 commit c0eb43e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/devel/contributing.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,12 @@ Then they will receive messages like
455455
DEBUG:matplotlib.yourmodulename:Here is some information
456456
DEBUG:matplotlib.yourmodulename:Here is some more detailed information
457457
458+
Avoid using pre-computed strings (``f-strings``, ``str.format``,etc.) for logging because of security and
459+
performance issues, and because they interfere with style handlers. For example, use ``_log.error('hello %s', 'world')`` rather than
460+
``_log.error('hello {}'.format('world'))`` or ``_log.error(f'hello {s}')``.
461+
462+
463+
458464
Which logging level to use?
459465
~~~~~~~~~~~~~~~~~~~~~~~~~~~
460466

0 commit comments

Comments
 (0)