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
28421c6f
Kaydet (Commit)
28421c6f
authored
Mar 29, 2013
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17540: Added style to Formatter configuration by dict.
üst
6d2bc6e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
config.py
Lib/logging/config.py
+4
-2
test_logging.py
Lib/test/test_logging.py
+4
-1
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/logging/config.py
Dosyayı görüntüle @
28421c6f
...
...
@@ -669,7 +669,8 @@ class DictConfigurator(BaseConfigurator):
else
:
fmt
=
config
.
get
(
'format'
,
None
)
dfmt
=
config
.
get
(
'datefmt'
,
None
)
result
=
logging
.
Formatter
(
fmt
,
dfmt
)
style
=
config
.
get
(
'style'
,
'
%
'
)
result
=
logging
.
Formatter
(
fmt
,
dfmt
,
style
)
return
result
def
configure_filter
(
self
,
config
):
...
...
@@ -691,6 +692,7 @@ class DictConfigurator(BaseConfigurator):
def
configure_handler
(
self
,
config
):
"""Configure a handler from a dictionary."""
config_copy
=
dict
(
config
)
# for restoring in case of error
formatter
=
config
.
pop
(
'formatter'
,
None
)
if
formatter
:
try
:
...
...
@@ -714,7 +716,7 @@ class DictConfigurator(BaseConfigurator):
try
:
th
=
self
.
config
[
'handlers'
][
config
[
'target'
]]
if
not
isinstance
(
th
,
logging
.
Handler
):
config
[
'class'
]
=
cname
# restore for deferred configuration
config
.
update
(
config_copy
)
# restore for deferred cfg
raise
TypeError
(
'target not configured yet'
)
config
[
'target'
]
=
th
except
Exception
as
e
:
...
...
Lib/test/test_logging.py
Dosyayı görüntüle @
28421c6f
...
...
@@ -2398,7 +2398,8 @@ class ConfigDictTest(BaseTest):
"version"
:
1
,
"formatters"
:
{
"mySimpleFormatter"
:
{
"format"
:
"
%(asctime)
s (
%(name)
s)
%(levelname)
s:
%(message)
s"
"format"
:
"
%(asctime)
s (
%(name)
s)
%(levelname)
s:
%(message)
s"
,
"style"
:
"$"
}
},
"handlers"
:
{
...
...
@@ -2728,6 +2729,8 @@ class ConfigDictTest(BaseTest):
self
.
apply_config
(
self
.
out_of_order
)
handler
=
logging
.
getLogger
(
'mymodule'
)
.
handlers
[
0
]
self
.
assertIsInstance
(
handler
.
target
,
logging
.
Handler
)
self
.
assertIsInstance
(
handler
.
formatter
.
_style
,
logging
.
StringTemplateStyle
)
def
test_baseconfig
(
self
):
d
=
{
...
...
Misc/NEWS
Dosyayı görüntüle @
28421c6f
...
...
@@ -200,6 +200,8 @@ Core and Builtins
Library
-------
-
Issue
#
17540
:
Added
style
to
formatter
configuration
by
dict
.
-
Issue
#
17536
:
Add
to
webbrowser
's browser list: www-browser, x-www-browser,
iceweasel, iceape.
...
...
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