Skip to content
Snippets Groups Projects
Unverified Commit eff67788 authored by Miss Islington (bot)'s avatar Miss Islington (bot) Committed by GitHub
Browse files

[3.11] gh-95516: Add param types and clarify param descriptions of LogRecord (GH-95517) (GH-95566)

parent 8570f6d1
Branches
Tags
No related merge requests found
...@@ -707,6 +707,7 @@ the :class:`LogRecord` being processed. Obviously changing the LogRecord needs ...@@ -707,6 +707,7 @@ the :class:`LogRecord` being processed. Obviously changing the LogRecord needs
to be done with some care, but it does allow the injection of contextual to be done with some care, but it does allow the injection of contextual
information into logs (see :ref:`filters-contextual`). information into logs (see :ref:`filters-contextual`).
.. _log-record: .. _log-record:
LogRecord Objects LogRecord Objects
...@@ -722,32 +723,54 @@ wire). ...@@ -722,32 +723,54 @@ wire).
Contains all the information pertinent to the event being logged. Contains all the information pertinent to the event being logged.
The primary information is passed in :attr:`msg` and :attr:`args`, which The primary information is passed in *msg* and *args*,
are combined using ``msg % args`` to create the :attr:`message` field of the which are combined using ``msg % args`` to create
record. the :attr:`!message` attribute of the record.
:param name: The name of the logger used to log the event
represented by this :class:`!LogRecord`.
Note that the logger name in the :class:`!LogRecord`
will always have this value,
even though it may be emitted by a handler
attached to a different (ancestor) logger.
:type name: str
:param name: The name of the logger used to log the event represented by :param level: The :ref:`numeric level <levels>` of the logging event
this LogRecord. Note that this name will always have this (such as ``10`` for ``DEBUG``, ``20`` for ``INFO``, etc).
value, even though it may be emitted by a handler attached to
a different (ancestor) logger.
:param level: The numeric level of the logging event (one of DEBUG, INFO etc.)
Note that this is converted to *two* attributes of the LogRecord: Note that this is converted to *two* attributes of the LogRecord:
``levelno`` for the numeric value and ``levelname`` for the :attr:`!levelno` for the numeric value
corresponding level name. and :attr:`!levelname` for the corresponding level name.
:param pathname: The full pathname of the source file where the logging call :type level: int
was made.
:param lineno: The line number in the source file where the logging call was :param pathname: The full string path of the source file
made. where the logging call was made.
:param msg: The event description message, possibly a format string with :type pathname: str
placeholders for variable data.
:param args: Variable data to merge into the *msg* argument to obtain the :param lineno: The line number in the source file
event description. where the logging call was made.
:type lineno: int
:param msg: The event description message,
which can be a %-format string with placeholders for variable data.
:type msg: str
:param args: Variable data to merge into the *msg* argument
to obtain the event description.
:type args: tuple | dict[str, typing.Any]
:param exc_info: An exception tuple with the current exception information, :param exc_info: An exception tuple with the current exception information,
as returned by :func:`sys.exc_info`,
or ``None`` if no exception information is available. or ``None`` if no exception information is available.
:param func: The name of the function or method from which the logging call :type exc_info: tuple[type[BaseException], BaseException, types.TracebackType] | None
was invoked.
:param sinfo: A text string representing stack information from the base of :param func: The name of the function or method
the stack in the current thread, up to the logging call. from which the logging call was invoked.
:type func: str | None
:param sinfo: A text string representing stack information
from the base of the stack in the current thread,
up to the logging call.
:type sinfo: str | None
.. method:: getMessage() .. method:: getMessage()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment