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
212b590e
Kaydet (Commit)
212b590e
authored
Eyl 21, 2010
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
logging: Updated LoggerAdapter implementation.
üst
c84f0169
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
26 deletions
+29
-26
__init__.py
Lib/logging/__init__.py
+26
-26
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/logging/__init__.py
Dosyayı görüntüle @
212b590e
...
...
@@ -1376,64 +1376,64 @@ class LoggerAdapter(object):
kwargs
[
"extra"
]
=
self
.
extra
return
msg
,
kwargs
#
# Boilerplate convenience methods
#
def
debug
(
self
,
msg
,
*
args
,
**
kwargs
):
"""
Delegate a debug call to the underlying logger, after adding
contextual information from this adapter instance.
Delegate a debug call to the underlying logger.
"""
msg
,
kwargs
=
self
.
process
(
msg
,
kwargs
)
self
.
logger
.
debug
(
msg
,
*
args
,
**
kwargs
)
self
.
log
(
DEBUG
,
msg
,
*
args
,
**
kwargs
)
def
info
(
self
,
msg
,
*
args
,
**
kwargs
):
"""
Delegate an info call to the underlying logger, after adding
contextual information from this adapter instance.
Delegate an info call to the underlying logger.
"""
msg
,
kwargs
=
self
.
process
(
msg
,
kwargs
)
self
.
logger
.
info
(
msg
,
*
args
,
**
kwargs
)
self
.
log
(
INFO
,
msg
,
*
args
,
**
kwargs
)
def
warning
(
self
,
msg
,
*
args
,
**
kwargs
):
"""
Delegate a warning call to the underlying logger, after adding
contextual information from this adapter instance.
Delegate a warning call to the underlying logger.
"""
msg
,
kwargs
=
self
.
process
(
msg
,
kwargs
)
self
.
logger
.
warning
(
msg
,
*
args
,
**
kwargs
)
self
.
log
(
WARNING
,
msg
,
*
args
,
**
kwargs
)
warn
=
warning
def
error
(
self
,
msg
,
*
args
,
**
kwargs
):
"""
Delegate an error call to the underlying logger, after adding
contextual information from this adapter instance.
Delegate an error call to the underlying logger.
"""
msg
,
kwargs
=
self
.
process
(
msg
,
kwargs
)
self
.
logger
.
error
(
msg
,
*
args
,
**
kwargs
)
self
.
log
(
ERROR
,
msg
,
*
args
,
**
kwargs
)
def
exception
(
self
,
msg
,
*
args
,
**
kwargs
):
"""
Delegate an exception call to the underlying logger, after adding
contextual information from this adapter instance.
Delegate an exception call to the underlying logger.
"""
msg
,
kwargs
=
self
.
process
(
msg
,
kwargs
)
kwargs
[
"exc_info"
]
=
1
self
.
log
ger
.
error
(
msg
,
*
args
,
**
kwargs
)
self
.
log
(
ERROR
,
msg
,
*
args
,
**
kwargs
)
def
critical
(
self
,
msg
,
*
args
,
**
kwargs
):
"""
Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance.
Delegate a critical call to the underlying logger.
"""
msg
,
kwargs
=
self
.
process
(
msg
,
kwargs
)
self
.
logger
.
critical
(
msg
,
*
args
,
**
kwargs
)
self
.
log
(
CRITICAL
,
msg
,
*
args
,
**
kwargs
)
def
log
(
self
,
level
,
msg
,
*
args
,
**
kwargs
):
"""
Delegate a log call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg
,
kwargs
=
self
.
process
(
msg
,
kwargs
)
self
.
logger
.
log
(
level
,
msg
,
*
args
,
**
kwargs
)
if
self
.
isEnabledFor
(
level
):
msg
,
kwargs
=
self
.
process
(
msg
,
kwargs
)
self
.
logger
.
_log
(
level
,
msg
,
args
,
**
kwargs
)
def
isEnabledFor
(
self
,
level
):
"""
Is this logger enabled for level 'level'?
"""
if
self
.
logger
.
manager
.
disable
>=
level
:
return
False
return
level
>=
self
.
getEffectiveLevel
()
def
setLevel
(
self
,
level
):
"""
...
...
Misc/NEWS
Dosyayı görüntüle @
212b590e
...
...
@@ -58,6 +58,9 @@ Core and Builtins
Library
-------
- logging: Changed LoggerAdapter implementation internally, to make it
easier to subclass in a useful way.
- logging: hasHandlers method was added to Logger, and isEnabledFor,
getEffectiveLevel, hasHandlers and setLevel were added to LoggerAdapter.
LoggerAdapter was introduced into the unit tests for logging.
...
...
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