Skip to content

Commit e13f49a

Browse files
authored
[3.10] gh-84095: Fill documentation gap regarding user-defined objects. (GH-… (GH-96576)
1 parent f5a7847 commit e13f49a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Doc/library/logging.config.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,25 @@ valid keyword parameter name, and so will not clash with the names of
524524
the keyword arguments used in the call. The ``'()'`` also serves as a
525525
mnemonic that the corresponding value is a callable.
526526

527+
You can also specify a special key ``'.'`` whose value is a dictionary is a
528+
mapping of attribute names to values. If found, the specified attributes will
529+
be set on the user-defined object before it is returned. Thus, with the
530+
following configuration::
531+
532+
{
533+
'()' : 'my.package.customFormatterFactory',
534+
'bar' : 'baz',
535+
'spam' : 99.9,
536+
'answer' : 42,
537+
'.' {
538+
'foo': 'bar',
539+
'baz': 'bozz'
540+
}
541+
}
542+
543+
the returned formatter will have attribute ``foo`` set to ``'bar'`` and
544+
attribute ``baz`` set to ``'bozz'``.
545+
527546

528547
.. _logging-config-dict-externalobj:
529548

@@ -823,7 +842,7 @@ Sections which specify formatter configuration are typified by the following.
823842
[formatter_form01]
824843
format=F1 %(asctime)s %(levelname)s %(message)s
825844
datefmt=
826-
style='%'
845+
style=%
827846
validate=True
828847
class=logging.Formatter
829848

0 commit comments

Comments
 (0)