Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(8)

Side by Side Diff: Doc/library/logging.handlers.rst

Issue 18759: Fix internal doc references for logging package (Closed)
Patch Set: Created 6 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/logging.config.rst ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`logging.handlers` --- Logging handlers 1 :mod:`logging.handlers` --- Logging handlers
2 ============================================ 2 ============================================
3 3
4 .. module:: logging.handlers 4 .. module:: logging.handlers
5 :synopsis: Handlers for the logging module. 5 :synopsis: Handlers for the logging module.
6 6
7 7
8 .. moduleauthor:: Vinay Sajip <vinay_sajip@red-dove.com> 8 .. moduleauthor:: Vinay Sajip <vinay_sajip@red-dove.com>
9 .. sectionauthor:: Vinay Sajip <vinay_sajip@red-dove.com> 9 .. sectionauthor:: Vinay Sajip <vinay_sajip@red-dove.com>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 If a formatter is specified, it is used to format the record. The record 47 If a formatter is specified, it is used to format the record. The record
48 is then written to the stream with a terminator. If exception information 48 is then written to the stream with a terminator. If exception information
49 is present, it is formatted using :func:`traceback.print_exception` and 49 is present, it is formatted using :func:`traceback.print_exception` and
50 appended to the stream. 50 appended to the stream.
51 51
52 52
53 .. method:: flush() 53 .. method:: flush()
54 54
55 Flushes the stream by calling its :meth:`flush` method. Note that the 55 Flushes the stream by calling its :meth:`flush` method. Note that the
56 :meth:`close` method is inherited from :class:`Handler` and so does 56 :meth:`close` method is inherited from :class:`~logging.Handler` and so
57 no output, so an explicit :meth:`flush` call may be needed at times. 57 does no output, so an explicit :meth:`flush` call may be needed at times.
58 58
59 .. versionchanged:: 3.2 59 .. versionchanged:: 3.2
60 The ``StreamHandler`` class now has a ``terminator`` attribute, default 60 The ``StreamHandler`` class now has a ``terminator`` attribute, default
61 value ``'\n'``, which is used as the terminator when writing a formatted 61 value ``'\n'``, which is used as the terminator when writing a formatted
62 record to a stream. If you don't want this newline termination, you can 62 record to a stream. If you don't want this newline termination, you can
63 set the handler instance's ``terminator`` attribute to the empty string. 63 set the handler instance's ``terminator`` attribute to the empty string.
64 In earlier versions, the terminator was hardcoded as ``'\n'``. 64 In earlier versions, the terminator was hardcoded as ``'\n'``.
65 65
66 .. _file-handler: 66 .. _file-handler:
67 67
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 A file change can happen because of usage of programs such as *newsyslog* and 138 A file change can happen because of usage of programs such as *newsyslog* and
139 *logrotate* which perform log file rotation. This handler, intended for use 139 *logrotate* which perform log file rotation. This handler, intended for use
140 under Unix/Linux, watches the file to see if it has changed since the last emit. 140 under Unix/Linux, watches the file to see if it has changed since the last emit.
141 (A file is deemed to have changed if its device or inode have changed.) If the 141 (A file is deemed to have changed if its device or inode have changed.) If the
142 file has changed, the old file stream is closed, and the file opened to get a 142 file has changed, the old file stream is closed, and the file opened to get a
143 new stream. 143 new stream.
144 144
145 This handler is not appropriate for use under Windows, because under Windows 145 This handler is not appropriate for use under Windows, because under Windows
146 open log files cannot be moved or renamed - logging opens the files with 146 open log files cannot be moved or renamed - logging opens the files with
147 exclusive locks - and so there is no need for such a handler. Furthermore, 147 exclusive locks - and so there is no need for such a handler. Furthermore,
148 *ST_INO* is not supported under Windows; :func:`stat` always returns zero for 148 *ST_INO* is not supported under Windows; :func:`~os.stat` always returns zero
149 this value. 149 for this value.
150 150
151 151
152 .. class:: WatchedFileHandler(filename[,mode[, encoding[, delay]]]) 152 .. class:: WatchedFileHandler(filename[,mode[, encoding[, delay]]])
153 153
154 Returns a new instance of the :class:`WatchedFileHandler` class. The specifie d 154 Returns a new instance of the :class:`WatchedFileHandler` class. The specifie d
155 file is opened and used as the stream for logging. If *mode* is not specified , 155 file is opened and used as the stream for logging. If *mode* is not specified ,
156 :const:`'a'` is used. If *encoding* is not *None*, it is used to open the fi le 156 :const:`'a'` is used. If *encoding* is not *None*, it is used to open the fi le
157 with that encoding. If *delay* is true, then file opening is deferred until the 157 with that encoding. If *delay* is true, then file opening is deferred until the
158 first call to :meth:`emit`. By default, the file grows indefinitely. 158 first call to :meth:`emit`. By default, the file grows indefinitely.
159 159
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 382
383 Closes the socket. 383 Closes the socket.
384 384
385 385
386 .. method:: emit() 386 .. method:: emit()
387 387
388 Pickles the record's attribute dictionary and writes it to the socket in 388 Pickles the record's attribute dictionary and writes it to the socket in
389 binary format. If there is an error with the socket, silently drops the 389 binary format. If there is an error with the socket, silently drops the
390 packet. If the connection was previously lost, re-establishes the 390 packet. If the connection was previously lost, re-establishes the
391 connection. To unpickle the record at the receiving end into a 391 connection. To unpickle the record at the receiving end into a
392 :class:`LogRecord`, use the :func:`makeLogRecord` function. 392 :class:`~logging.LogRecord`, use the :func:`~logging.makeLogRecord`
393 function.
393 394
394 395
395 .. method:: handleError() 396 .. method:: handleError()
396 397
397 Handles an error which has occurred during :meth:`emit`. The most likely 398 Handles an error which has occurred during :meth:`emit`. The most likely
398 cause is a lost connection. Closes the socket so that we can retry on the 399 cause is a lost connection. Closes the socket so that we can retry on the
399 next event. 400 next event.
400 401
401 402
402 .. method:: makeSocket() 403 .. method:: makeSocket()
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 461
461 Returns a new instance of the :class:`DatagramHandler` class intended to 462 Returns a new instance of the :class:`DatagramHandler` class intended to
462 communicate with a remote machine whose address is given by *host* and *port* . 463 communicate with a remote machine whose address is given by *host* and *port* .
463 464
464 465
465 .. method:: emit() 466 .. method:: emit()
466 467
467 Pickles the record's attribute dictionary and writes it to the socket in 468 Pickles the record's attribute dictionary and writes it to the socket in
468 binary format. If there is an error with the socket, silently drops the 469 binary format. If there is an error with the socket, silently drops the
469 packet. To unpickle the record at the receiving end into a 470 packet. To unpickle the record at the receiving end into a
470 :class:`LogRecord`, use the :func:`makeLogRecord` function. 471 :class:`~logging.LogRecord`, use the :func:`~logging.makeLogRecord`
472 function.
471 473
472 474
473 .. method:: makeSocket() 475 .. method:: makeSocket()
474 476
475 The factory method of :class:`SocketHandler` is here overridden to create 477 The factory method of :class:`SocketHandler` is here overridden to create
476 a UDP socket (:const:`socket.SOCK_DGRAM`). 478 a UDP socket (:const:`socket.SOCK_DGRAM`).
477 479
478 480
479 .. method:: send(s) 481 .. method:: send(s)
480 482
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 979
978 .. seealso:: 980 .. seealso::
979 981
980 Module :mod:`logging` 982 Module :mod:`logging`
981 API reference for the logging module. 983 API reference for the logging module.
982 984
983 Module :mod:`logging.config` 985 Module :mod:`logging.config`
984 Configuration API for the logging module. 986 Configuration API for the logging module.
985 987
986 988
OLDNEW
« no previous file with comments | « Doc/library/logging.config.rst ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+