This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: RFC: string Multiline Formatter
Type: enhancement Stage: resolved
Components: Library (Lib) Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: creative-resort, eric.smith, terry.reedy
Priority: normal Keywords: patch

Created on 2021-07-23 08:35 by creative-resort, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 27301 closed creative-resort, 2021-07-23 09:03
Messages (5)
msg398034 - (view) Author: creative-resort (creative-resort) * Date: 2021-07-23 08:35
I'm opening this issue to propose the following enhancement
and a PR on GitHub.

Concerning: https://github.com/python/cpython/blob/main/Lib/string.py

The idea:
Format strings, that are comprised of field values with newlines (Multiline)
as Multiline strings in a quasi tabbed format.

--> In particular useful for logging of information, that occupies multiple lines.

For example: '{levelname}:{name}:{message}:{api}', 
             where the message and the api field is a string with multiple lines (contains newlines)

The result:   2021-07-23 09:50:28,981 module_name WARNING     Quota exceeded         Google-Cloud-API
                                                              Backing off for 5s     version: v1
                                                              after trying 2x
msg398039 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-07-23 09:24
Can you provide a specification of what this class does? You’ve given an example, but not a description of the behavior.
msg398043 - (view) Author: creative-resort (creative-resort) * Date: 2021-07-23 10:37
Thank you.

In the process of providing that description I also just realized – after also seeing the build fail – that I'm making use of a library which is not part of the core (llist) for a doubly linked list.

That dependency is most probably a deal breaker and would require refactoring.
msg398099 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-07-23 21:40
I suggest you close this issue and if you have an improved code, propose it on python-ideas list for discussion.
msg398111 - (view) Author: creative-resort (creative-resort) * Date: 2021-07-24 01:18
Thank you for your kind guidance :)
History
Date User Action Args
2022-04-11 14:59:47adminsetgithub: 88885
2021-07-24 01:18:24creative-resortsetstatus: open -> closed

messages: + msg398111
stage: patch review -> resolved
2021-07-23 21:40:52terry.reedysetnosy: + terry.reedy
messages: + msg398099
2021-07-23 10:37:08creative-resortsetmessages: + msg398043
2021-07-23 09:24:32eric.smithsetnosy: + eric.smith
messages: + msg398039
2021-07-23 09:03:05creative-resortsetkeywords: + patch
stage: patch review
pull_requests: + pull_request25845
2021-07-23 08:35:04creative-resortcreate