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.
This commit is contained in:
Andrés Delfino 2018-06-25 03:06:10 -03:00 committed by Tal Einat
parent cf67d6a934
commit a8ddf85a84
2 changed files with 27 additions and 19 deletions

View File

@ -971,6 +971,11 @@ are always available. They are listed here in alphabetical order.
encoding. (For reading and writing raw bytes use binary mode and leave encoding. (For reading and writing raw bytes use binary mode and leave
*encoding* unspecified.) The available modes are: *encoding* unspecified.) The available modes are:
.. _filemodes:
.. index::
pair: file; modes
========= =============================================================== ========= ===============================================================
Character Meaning Character Meaning
========= =============================================================== ========= ===============================================================

View File

@ -1147,41 +1147,44 @@ functions.
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| Format | Description | | Format | Description |
+==============+=============================================+ +==============+=============================================+
| ``filename`` | Specifies that a FileHandler be created, | | *filename* | Specifies that a FileHandler be created, |
| | using the specified filename, rather than a | | | using the specified filename, rather than a |
| | StreamHandler. | | | StreamHandler. |
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| ``filemode`` | Specifies the mode to open the file, if | | *filemode* | If *filename* is specified, open the file |
| | filename is specified (if filemode is | | | in this :ref:`mode <filemodes>`. Defaults |
| | unspecified, it defaults to 'a'). | | | to ``'a'``. |
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| ``format`` | Use the specified format string for the | | *format* | Use the specified format string for the |
| | handler. | | | handler. |
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| ``datefmt`` | Use the specified date/time format. | | *datefmt* | Use the specified date/time format, as |
| | accepted by :func:`time.strftime`. |
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| ``style`` | If ``format`` is specified, use this style | | *style* | If *format* is specified, use this style |
| | for the format string. One of '%', '{' or | | | for the format string. One of ``'%'``, |
| | '$' for %-formatting, :meth:`str.format` or | | | ``'{'`` or ``'$'`` for :ref:`printf-style |
| | :class:`string.Template` respectively, and | | | <old-string-formatting>`, |
| | defaulting to '%' if not specified. | | | :meth:`str.format` or |
| | :class:`string.Template` respectively. |
| | Defaults to ``'%'``. |
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| ``level`` | Set the root logger level to the specified | | *level* | Set the root logger level to the specified |
| | level. | | | :ref:`level <levels>`. |
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| ``stream`` | Use the specified stream to initialize the | | *stream* | Use the specified stream to initialize the |
| | StreamHandler. Note that this argument is | | | StreamHandler. Note that this argument is |
| | incompatible with 'filename' - if both are | | | incompatible with *filename* - if both |
| | present, a ``ValueError`` is raised. | | | are present, a ``ValueError`` is raised. |
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| ``handlers`` | If specified, this should be an iterable of | | *handlers* | If specified, this should be an iterable of |
| | already created handlers to add to the root | | | already created handlers to add to the root |
| | logger. Any handlers which don't already | | | logger. Any handlers which don't already |
| | have a formatter set will be assigned the | | | have a formatter set will be assigned the |
| | default formatter created in this function. | | | default formatter created in this function. |
| | Note that this argument is incompatible | | | Note that this argument is incompatible |
| | with 'filename' or 'stream' - if both are | | | with *filename* or *stream* - if both |
| | present, a ``ValueError`` is raised. | | | are present, a ``ValueError`` is raised. |
+--------------+---------------------------------------------+ +--------------+---------------------------------------------+
| ``force`` | If this keyword argument is specified as | | ``force`` | If this keyword argument is specified as |
| | true, any existing handlers attached to the | | | true, any existing handlers attached to the |