Skip to content

Commit a8ddf85

Browse files
andresdelfinotaleinat
authored andcommitted
bpo-33943: Add references in the docs for logging.basicConfig (GH-7858)
Adds references to info about file modes, `time.strftime()`, string formatting syntaxes, and logging levels.
1 parent cf67d6a commit a8ddf85

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

Doc/library/functions.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,11 @@ are always available. They are listed here in alphabetical order.
971971
encoding. (For reading and writing raw bytes use binary mode and leave
972972
*encoding* unspecified.) The available modes are:
973973

974+
.. _filemodes:
975+
976+
.. index::
977+
pair: file; modes
978+
974979
========= ===============================================================
975980
Character Meaning
976981
========= ===============================================================

Doc/library/logging.rst

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,41 +1147,44 @@ functions.
11471147
+--------------+---------------------------------------------+
11481148
| Format | Description |
11491149
+==============+=============================================+
1150-
| ``filename`` | Specifies that a FileHandler be created, |
1150+
| *filename* | Specifies that a FileHandler be created, |
11511151
| | using the specified filename, rather than a |
11521152
| | StreamHandler. |
11531153
+--------------+---------------------------------------------+
1154-
| ``filemode`` | Specifies the mode to open the file, if |
1155-
| | filename is specified (if filemode is |
1156-
| | unspecified, it defaults to 'a'). |
1154+
| *filemode* | If *filename* is specified, open the file |
1155+
| | in this :ref:`mode <filemodes>`. Defaults |
1156+
| | to ``'a'``. |
11571157
+--------------+---------------------------------------------+
1158-
| ``format`` | Use the specified format string for the |
1158+
| *format* | Use the specified format string for the |
11591159
| | handler. |
11601160
+--------------+---------------------------------------------+
1161-
| ``datefmt`` | Use the specified date/time format. |
1161+
| *datefmt* | Use the specified date/time format, as |
1162+
| | accepted by :func:`time.strftime`. |
11621163
+--------------+---------------------------------------------+
1163-
| ``style`` | If ``format`` is specified, use this style |
1164-
| | for the format string. One of '%', '{' or |
1165-
| | '$' for %-formatting, :meth:`str.format` or |
1166-
| | :class:`string.Template` respectively, and |
1167-
| | defaulting to '%' if not specified. |
1164+
| *style* | If *format* is specified, use this style |
1165+
| | for the format string. One of ``'%'``, |
1166+
| | ``'{'`` or ``'$'`` for :ref:`printf-style |
1167+
| | <old-string-formatting>`, |
1168+
| | :meth:`str.format` or |
1169+
| | :class:`string.Template` respectively. |
1170+
| | Defaults to ``'%'``. |
11681171
+--------------+---------------------------------------------+
1169-
| ``level`` | Set the root logger level to the specified |
1170-
| | level. |
1172+
| *level* | Set the root logger level to the specified |
1173+
| | :ref:`level <levels>`. |
11711174
+--------------+---------------------------------------------+
1172-
| ``stream`` | Use the specified stream to initialize the |
1175+
| *stream* | Use the specified stream to initialize the |
11731176
| | StreamHandler. Note that this argument is |
1174-
| | incompatible with 'filename' - if both are |
1175-
| | present, a ``ValueError`` is raised. |
1177+
| | incompatible with *filename* - if both |
1178+
| | are present, a ``ValueError`` is raised. |
11761179
+--------------+---------------------------------------------+
1177-
| ``handlers`` | If specified, this should be an iterable of |
1180+
| *handlers* | If specified, this should be an iterable of |
11781181
| | already created handlers to add to the root |
11791182
| | logger. Any handlers which don't already |
11801183
| | have a formatter set will be assigned the |
11811184
| | default formatter created in this function. |
11821185
| | Note that this argument is incompatible |
1183-
| | with 'filename' or 'stream' - if both are |
1184-
| | present, a ``ValueError`` is raised. |
1186+
| | with *filename* or *stream* - if both |
1187+
| | are present, a ``ValueError`` is raised. |
11851188
+--------------+---------------------------------------------+
11861189
| ``force`` | If this keyword argument is specified as |
11871190
| | true, any existing handlers attached to the |

0 commit comments

Comments
 (0)