We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6f6d76d + 51038fa commit 53946f2Copy full SHA for 53946f2
docs/correctness/not_letting_logger_format_messages.rst
@@ -0,0 +1,31 @@
1
+Not letting logger format messages
2
+----------------------------------
3
+
4
+When you log a message, do not format your message with parameters. You should
5
+let logger lib handle that.
6
7
8
+Anti-pattern
9
+------------
10
11
+.. code:: python
12
+ msg = "Error %s catched!"
13
+ logger.error(msg % 1337)
14
15
16
+Best practice(s)
17
+----------------
18
19
+Let logger format message
20
+.........................
21
22
+Pass message parameters as arguments to the logger function.
23
24
25
26
+ logger.error(msg, 1337)
27
28
29
+References
30
+----------
31
+- `Python logging howto <https://docs.python.org/3/howto/logging.html#logging-variable-data>`_
0 commit comments