Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

logging.Formatter docstring missing processName attribute. #134360

Closed
Labels
docsDocumentation in the Doc dir
@junhaoliao

Description

@junhaoliao

Documentation

The docstring forlogging.Formatter class is missing theprocessName attribute that is available inLogRecord and documented in the official Python documentation.

Issues

TheprocessName attribute is documented in theLogRecord attributes section of the Python documentation, but it's not listed in theFormatter class docstring that enumerates the attributes users can include in format strings.

+----------------+-------------------------+-----------------------------------------------+
| Attribute name| Format| Description|
+================+=========================+===============================================+
| args| You shouldn't need to| The tuple of arguments merged into ``msg`` to|
|| format this yourself.| produce ``message``, or a dict whose values|
||| are used for the merge (when there is only one|
||| argument, and it is a dictionary).|
+----------------+-------------------------+-----------------------------------------------+
| asctime| ``%(asctime)s``| Human-readable time when the|
|||:class:`LogRecord` was created. By default|
||| this is of the form '2003-07-08 16:49:45,896'|
||| (the numbers after the comma are millisecond|
||| portion of the time).|
+----------------+-------------------------+-----------------------------------------------+
| created| ``%(created)f``| Time when the:class:`LogRecord` was created|
||| (as returned by:func:`time.time_ns` / 1e9).|
+----------------+-------------------------+-----------------------------------------------+
| exc_info| You shouldn't need to| Exception tuple (à la ``sys.exc_info``) or,|
|| format this yourself.| if no exception has occurred, ``None``.|
+----------------+-------------------------+-----------------------------------------------+
| filename| ``%(filename)s``| Filename portion of ``pathname``.|
+----------------+-------------------------+-----------------------------------------------+
| funcName| ``%(funcName)s``| Name of function containing the logging call.|
+----------------+-------------------------+-----------------------------------------------+
| levelname| ``%(levelname)s``| Text logging level for the message|
||| (``'DEBUG'``, ``'INFO'``, ``'WARNING'``,|
||| ``'ERROR'``, ``'CRITICAL'``).|
+----------------+-------------------------+-----------------------------------------------+
| levelno| ``%(levelno)s``| Numeric logging level for the message|
||| (:const:`DEBUG`,:const:`INFO`,|
|||:const:`WARNING`,:const:`ERROR`,|
|||:const:`CRITICAL`).|
+----------------+-------------------------+-----------------------------------------------+
| lineno| ``%(lineno)d``| Source line number where the logging call was|
||| issued (if available).|
+----------------+-------------------------+-----------------------------------------------+
| message| ``%(message)s``| The logged message, computed as ``msg %|
||| args``. This is set when|
|||:meth:`Formatter.format` is invoked.|
+----------------+-------------------------+-----------------------------------------------+
| module| ``%(module)s``| Module (name portion of ``filename``).|
+----------------+-------------------------+-----------------------------------------------+
| msecs| ``%(msecs)d``| Millisecond portion of the time when the|
|||:class:`LogRecord` was created.|
+----------------+-------------------------+-----------------------------------------------+
| msg| You shouldn't need to| The format string passed in the original|
|| format this yourself.| logging call. Merged with ``args`` to|
||| produce ``message``, or an arbitrary object|
||| (see:ref:`arbitrary-object-messages`).|
+----------------+-------------------------+-----------------------------------------------+
| name| ``%(name)s``| Name of the logger used to log the call.|
+----------------+-------------------------+-----------------------------------------------+
| pathname| ``%(pathname)s``| Full pathname of the source file where the|
||| logging call was issued (if available).|
+----------------+-------------------------+-----------------------------------------------+
| process| ``%(process)d``| Process ID (if available).|
+----------------+-------------------------+-----------------------------------------------+
| processName| ``%(processName)s``| Process name (if available).|
+----------------+-------------------------+-----------------------------------------------+
| relativeCreated| ``%(relativeCreated)d``| Time in milliseconds when the LogRecord was|
||| created, relative to the time the logging|
||| module was loaded.|
+----------------+-------------------------+-----------------------------------------------+
| stack_info| You shouldn't need to| Stack frame information (where available)|
|| format this yourself.| from the bottom of the stack in the current|
||| thread, up to and including the stack frame|
||| of the logging call which resulted in the|
||| creation of this record.|
+----------------+-------------------------+-----------------------------------------------+
| thread| ``%(thread)d``| Thread ID (if available).|
+----------------+-------------------------+-----------------------------------------------+
| threadName| ``%(threadName)s``| Thread name (if available).|
+----------------+-------------------------+-----------------------------------------------+
| taskName| ``%(taskName)s``|:class:`asyncio.Task` name (if available).|
+----------------+-------------------------+-----------------------------------------------+
..versionchanged::3.1
*processName* was added.
..versionchanged::3.12
*taskName* was added.

Missing attribute:

  • processName - Process name (if available), added in Python 3.1

Suggested Fix

Add theprocessName attribute to the docstring with its description:

%(processName)s Process name (if available)

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp