From e13f49a0bc253f1b8939fd505547986183761768 Mon Sep 17 00:00:00 2001 From: Vinay Sajip <vinay_sajip@yahoo.co.uk> Date: Mon, 5 Sep 2022 08:21:22 +0100 Subject: [PATCH] =?UTF-8?q?[3.10]=20gh-84095:=20Fill=20documentation=20gap?= =?UTF-8?q?=20regarding=20user-defined=20objects.=20(GH-=E2=80=A6=20(GH-96?= =?UTF-8?q?576)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Doc/library/logging.config.rst | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Doc/library/logging.config.rst b/Doc/library/logging.config.rst index a1b8dc755ba..88a83538230 100644 --- a/Doc/library/logging.config.rst +++ b/Doc/library/logging.config.rst @@ -524,6 +524,25 @@ valid keyword parameter name, and so will not clash with the names of the keyword arguments used in the call. The ``'()'`` also serves as a mnemonic that the corresponding value is a callable. +You can also specify a special key ``'.'`` whose value is a dictionary is a +mapping of attribute names to values. If found, the specified attributes will +be set on the user-defined object before it is returned. Thus, with the +following configuration:: + + { + '()' : 'my.package.customFormatterFactory', + 'bar' : 'baz', + 'spam' : 99.9, + 'answer' : 42, + '.' { + 'foo': 'bar', + 'baz': 'bozz' + } + } + +the returned formatter will have attribute ``foo`` set to ``'bar'`` and +attribute ``baz`` set to ``'bozz'``. + .. _logging-config-dict-externalobj: @@ -823,7 +842,7 @@ Sections which specify formatter configuration are typified by the following. [formatter_form01] format=F1 %(asctime)s %(levelname)s %(message)s datefmt= - style='%' + style=% validate=True class=logging.Formatter -- GitLab