Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
6ea56d2e
Kaydet (Commit)
6ea56d2e
authored
Agu 02, 2017
tarafından
Preston Landers
Kaydeden (comit)
Vinay Sajip
Agu 02, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31080: Allowed logging.config.fileConfig() to accept both args and kwargs. (GH-2979)
üst
de34cbe9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
+15
-5
logging.config.rst
Doc/library/logging.config.rst
+8
-1
config.py
Lib/logging/config.py
+4
-2
test_logging.py
Lib/test/test_logging.py
+2
-2
2017-08-01-18-26-55.bpo-31080.2CFVCO.rst
...S.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst
+1
-0
No files found.
Doc/library/logging.config.rst
Dosyayı görüntüle @
6ea56d2e
...
@@ -715,7 +715,12 @@ a corresponding section in the configuration file.
...
@@ -715,7 +715,12 @@ a corresponding section in the configuration file.
The ``args`` entry, when :func:`eval`\ uated in the context of the ``logging``
The ``args`` entry, when :func:`eval`\ uated in the context of the ``logging``
package'
s
namespace
,
is
the
list
of
arguments
to
the
constructor
for
the
handler
package'
s
namespace
,
is
the
list
of
arguments
to
the
constructor
for
the
handler
class
.
Refer
to
the
constructors
for
the
relevant
handlers
,
or
to
the
examples
class
.
Refer
to
the
constructors
for
the
relevant
handlers
,
or
to
the
examples
below
,
to
see
how
typical
entries
are
constructed
.
below
,
to
see
how
typical
entries
are
constructed
.
If
not
provided
,
it
defaults
to
``()``.
The
optional
``
kwargs
``
entry
,
when
:
func
:`
eval
`\
uated
in
the
context
of
the
``
logging
``
package
's namespace, is the keyword argument dict to the constructor
for the handler class. If not provided, it defaults to ``{}``.
.. code-block:: ini
.. code-block:: ini
...
@@ -754,6 +759,7 @@ below, to see how typical entries are constructed.
...
@@ -754,6 +759,7 @@ below, to see how typical entries are constructed.
level=WARN
level=WARN
formatter=form07
formatter=form07
args=('
localhost
', '
from
@
abc
', ['
user1
@
abc
', '
user2
@
xyz
'], '
Logger
Subject
')
args=('
localhost
', '
from
@
abc
', ['
user1
@
abc
', '
user2
@
xyz
'], '
Logger
Subject
')
kwargs={'
timeout
': 10.0}
[handler_hand08]
[handler_hand08]
class=handlers.MemoryHandler
class=handlers.MemoryHandler
...
@@ -767,6 +773,7 @@ below, to see how typical entries are constructed.
...
@@ -767,6 +773,7 @@ below, to see how typical entries are constructed.
level=NOTSET
level=NOTSET
formatter=form09
formatter=form09
args=('
localhost
:
9022
', '
/
log
', '
GET
')
args=('
localhost
:
9022
', '
/
log
', '
GET
')
kwargs={'
secure
': True}
Sections which specify formatter configuration are typified by the following.
Sections which specify formatter configuration are typified by the following.
...
...
Lib/logging/config.py
Dosyayı görüntüle @
6ea56d2e
...
@@ -143,9 +143,11 @@ def _install_handlers(cp, formatters):
...
@@ -143,9 +143,11 @@ def _install_handlers(cp, formatters):
klass
=
eval
(
klass
,
vars
(
logging
))
klass
=
eval
(
klass
,
vars
(
logging
))
except
(
AttributeError
,
NameError
):
except
(
AttributeError
,
NameError
):
klass
=
_resolve
(
klass
)
klass
=
_resolve
(
klass
)
args
=
section
[
"args"
]
args
=
section
.
get
(
"args"
,
'()'
)
args
=
eval
(
args
,
vars
(
logging
))
args
=
eval
(
args
,
vars
(
logging
))
h
=
klass
(
*
args
)
kwargs
=
section
.
get
(
"kwargs"
,
'{}'
)
kwargs
=
eval
(
kwargs
,
vars
(
logging
))
h
=
klass
(
*
args
,
**
kwargs
)
if
"level"
in
section
:
if
"level"
in
section
:
level
=
section
[
"level"
]
level
=
section
[
"level"
]
h
.
setLevel
(
level
)
h
.
setLevel
(
level
)
...
...
Lib/test/test_logging.py
Dosyayı görüntüle @
6ea56d2e
...
@@ -1273,7 +1273,7 @@ class ConfigFileTest(BaseTest):
...
@@ -1273,7 +1273,7 @@ class ConfigFileTest(BaseTest):
datefmt=
datefmt=
"""
"""
# config7 adds a compiler logger.
# config7 adds a compiler logger
, and uses kwargs instead of args
.
config7
=
"""
config7
=
"""
[loggers]
[loggers]
keys=root,parser,compiler
keys=root,parser,compiler
...
@@ -1304,7 +1304,7 @@ class ConfigFileTest(BaseTest):
...
@@ -1304,7 +1304,7 @@ class ConfigFileTest(BaseTest):
class=StreamHandler
class=StreamHandler
level=NOTSET
level=NOTSET
formatter=form1
formatter=form1
args=(sys.stdout,)
kwargs={'stream': sys.stdout,}
[formatter_form1]
[formatter_form1]
format=
%(levelname)
s ++
%(message)
s
format=
%(levelname)
s ++
%(message)
s
...
...
Misc/NEWS.d/next/Library/2017-08-01-18-26-55.bpo-31080.2CFVCO.rst
0 → 100644
Dosyayı görüntüle @
6ea56d2e
Allow `logging.config.fileConfig` to accept kwargs and/or args.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment