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
ef2335ca
Kaydet (Commit)
ef2335ca
authored
Eyl 05, 2010
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add PEP 391 to whatsnew
üst
58a7b460
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
3.2.rst
Doc/whatsnew/3.2.rst
+43
-0
No files found.
Doc/whatsnew/3.2.rst
Dosyayı görüntüle @
ef2335ca
...
@@ -51,6 +51,49 @@
...
@@ -51,6 +51,49 @@
This article explains the new features in Python 3.2, compared to 3.1.
This article explains the new features in Python 3.2, compared to 3.1.
PEP 391: Dictionary Based Configuration for Logging
===================================================
The :mod:`logging` module had two ways of configuring the module, either
calling functions for each option or by reading an external file saved
in a ConfigParser format. Those options did not provide the flexibility
to create configurations from JSON or YAML files and they did not support
incremental configuration which is needed for specifying logger options
from a command line.
To support a more flexible style, the module now offers
:func:`logging.config.dictConfig` to use dictionaries to specify logger
configurations (including formatters, handlers, filters, and loggers).
For example::
>>> import logging.config
>>> logging.config.dictConfig(json.load(open('log.cfg', 'rb')))
The above fragment configures logging from a JSON encoded dictionary stored in
file called "log.cfg". Here's a working example of a configuration dictionary::
{"version": 1,
"formatters": {"brief": {"format": "%(levelname)-8s: %(name)-15s: %(message)s"},
"full": {"format": "%(asctime)s %(name)-15s %(levelname)-8s %(message)s"},
},
"handlers": {"console": {
"class": "logging.StreamHandler",
"formatter": "brief",
"level": "INFO",
"stream": "ext://sys.stdout"},
"console_priority": {
"class": "logging.StreamHandler",
"formatter": "full",
"level": "ERROR",
"stream": "ext://sys.stderr"},
},
"root": {"level": "DEBUG", "handlers": ["console", "console_priority"]}}
.. seealso::
:pep:`391` - Dictionary Based Configuration for Logging
PEP written by Vinay Sajip.
PEP 3147: PYC Repository Directories
PEP 3147: PYC Repository Directories
=====================================
=====================================
...
...
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