Skip to content

Commit 4e30421

Browse files
committed
gh-151946: Fix Sphinx reference warnings in logging.handlers
1 parent 56ae0b8 commit 4e30421

1 file changed

Lines changed: 24 additions & 22 deletions

File tree

Doc/library/logging.handlers.rst

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ StreamHandler
3131

3232
The :class:`StreamHandler` class, located in the core :mod:`logging` package,
3333
sends logging output to streams such as *sys.stdout*, *sys.stderr* or any
34-
file-like object (or, more precisely, any object which supports :meth:`write`
35-
and :meth:`flush` methods).
34+
file-like object (or, more precisely, any object which supports :meth:`~io.TextIOBase.write`
35+
and :meth:`~io.IOBase.flush` methods).
3636

3737

3838
.. class:: StreamHandler(stream=None)
@@ -52,9 +52,10 @@ and :meth:`flush` methods).
5252

5353
.. method:: flush()
5454

55-
Flushes the stream by calling its :meth:`flush` method. Note that the
56-
:meth:`close` method is inherited from :class:`~logging.Handler` and so
57-
does no output, so an explicit :meth:`flush` call may be needed at times.
55+
Flushes the stream by calling its :meth:`~io.IOBase.flush` method. Note that
56+
the :meth:`~logging.Handler.close` method is inherited from
57+
:class:`~logging.Handler` and so does no output, so an explicit
58+
:meth:`~io.IOBase.flush` call may be needed at times.
5859

5960
.. method:: setStream(stream)
6061

@@ -158,8 +159,8 @@ WatchedFileHandler
158159
.. currentmodule:: logging.handlers
159160

160161
The :class:`WatchedFileHandler` class, located in the :mod:`!logging.handlers`
161-
module, is a :class:`FileHandler` which watches the file it is logging to. If
162-
the file changes, it is closed and reopened using the file name.
162+
module, is a :class:`~logging.FileHandler` which watches the file it is logging
163+
to. If the file changes, it is closed and reopened using the file name.
163164

164165
A file change can happen because of usage of programs such as *newsyslog* and
165166
*logrotate* which perform log file rotation. This handler, intended for use
@@ -218,7 +219,7 @@ need to override.
218219

219220
.. class:: BaseRotatingHandler(filename, mode, encoding=None, delay=False, errors=None)
220221

221-
The parameters are as for :class:`FileHandler`. The attributes are:
222+
The parameters are as for :class:`~logging.FileHandler`. The attributes are:
222223

223224
.. attribute:: namer
224225

@@ -290,8 +291,8 @@ The reason the attributes exist is to save you having to subclass - you can use
290291
the same callables for instances of :class:`RotatingFileHandler` and
291292
:class:`TimedRotatingFileHandler`. If either the namer or rotator callable
292293
raises an exception, this will be handled in the same way as any other
293-
exception during an :meth:`emit` call, i.e. via the :meth:`handleError` method
294-
of the handler.
294+
exception during a :meth:`~logging.Handler.emit` call, i.e. via the
295+
:meth:`~logging.Handler.handleError` method of the handler.
295296

296297
If you need to make more significant changes to rotation processing, you can
297298
override the methods.
@@ -633,7 +634,7 @@ supports sending logging messages to a remote or local Unix syslog.
633634
alternative to providing a ``(host, port)`` tuple is providing an address as a
634635
string, for example '/dev/log'. In this case, a Unix domain socket is used to
635636
send the message to the syslog. If *facility* is not specified,
636-
:const:`LOG_USER` is used. The type of socket opened depends on the
637+
:const:`~syslog.LOG_USER` is used. The type of socket opened depends on the
637638
*socktype* argument, which defaults to :const:`socket.SOCK_DGRAM` and thus
638639
opens a UDP socket. To open a TCP socket (for use with the newer syslog
639640
daemons such as rsyslog), specify a value of :const:`socket.SOCK_STREAM`.
@@ -846,9 +847,10 @@ extensions for Python installed.
846847

847848
Returns the event type for the record. Override this if you want to
848849
specify your own types. This version does a mapping using the handler's
849-
typemap attribute, which is set up in :meth:`__init__` to a dictionary
850-
which contains mappings for :const:`DEBUG`, :const:`INFO`,
851-
:const:`WARNING`, :const:`ERROR` and :const:`CRITICAL`. If you are using
850+
typemap attribute, which is set up in :meth:`!__init__`
851+
to a dictionary which contains mappings for :const:`~logging.DEBUG`,
852+
:const:`~logging.INFO`, :const:`~logging.WARNING`,
853+
:const:`~logging.ERROR` and :const:`~logging.CRITICAL`. If you are using
852854
your own levels, you will either need to override this method or place a
853855
suitable dictionary in the handler's *typemap* attribute.
854856

@@ -915,8 +917,8 @@ event of a certain severity or greater is seen.
915917
:class:`MemoryHandler` is a subclass of the more general
916918
:class:`BufferingHandler`, which is an abstract class. This buffers logging
917919
records in memory. Whenever each record is added to the buffer, a check is made
918-
by calling :meth:`shouldFlush` to see if the buffer should be flushed. If it
919-
should, then :meth:`flush` is expected to do the flushing.
920+
by calling :meth:`!shouldFlush` to see if the buffer should be flushed. If it
921+
should, then :meth:`!flush` is expected to do the flushing.
920922

921923

922924
.. class:: BufferingHandler(capacity)
@@ -927,8 +929,8 @@ should, then :meth:`flush` is expected to do the flushing.
927929

928930
.. method:: emit(record)
929931

930-
Append the record to the buffer. If :meth:`shouldFlush` returns true,
931-
call :meth:`flush` to process the buffer.
932+
Append the record to the buffer. If :meth:`!shouldFlush` returns true,
933+
call :meth:`!flush` to process the buffer.
932934

933935

934936
.. method:: flush()
@@ -948,7 +950,7 @@ should, then :meth:`flush` is expected to do the flushing.
948950

949951
Returns a new instance of the :class:`MemoryHandler` class. The instance is
950952
initialized with a buffer size of *capacity* (number of records buffered).
951-
If *flushLevel* is not specified, :const:`ERROR` is used. If no *target* is
953+
If *flushLevel* is not specified, :const:`~logging.ERROR` is used. If no *target* is
952954
specified, the target will need to be set using :meth:`setTarget` before this
953955
handler does anything useful. If *flushOnClose* is specified as ``False``,
954956
then the buffer is *not* flushed when the handler is closed. If not specified
@@ -961,7 +963,7 @@ should, then :meth:`flush` is expected to do the flushing.
961963

962964
.. method:: close()
963965

964-
Calls :meth:`flush`, sets the target to ``None`` and clears the
966+
Calls :meth:`!flush`, sets the target to ``None`` and clears the
965967
buffer.
966968

967969

@@ -1088,9 +1090,9 @@ possible, while any potentially slow operations (such as sending an email via
10881090
The base implementation formats the record to merge the message,
10891091
arguments, exception and stack information, if present. It also removes
10901092
unpickleable items from the record in-place. Specifically, it overwrites
1091-
the record's :attr:`msg` and :attr:`message` attributes with the merged
1093+
the record's :attr:`!msg` and :attr:`!message` attributes with the merged
10921094
message (obtained by calling the handler's :meth:`format` method), and
1093-
sets the :attr:`args`, :attr:`exc_info` and :attr:`exc_text` attributes
1095+
sets the :attr:`!args`, :attr:`!exc_info` and :attr:`!exc_text` attributes
10941096
to ``None``.
10951097

10961098
You might want to override this method if you want to convert

0 commit comments

Comments
 (0)