mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Added some methods to LoggerAdapter, and updated documentation.
This commit is contained in:
parent
ceff566886
commit
c84f016988
5 changed files with 32 additions and 9 deletions
|
@ -1400,6 +1400,8 @@ class LoggerAdapter(object):
|
|||
msg, kwargs = self.process(msg, kwargs)
|
||||
self.logger.warning(msg, *args, **kwargs)
|
||||
|
||||
warn = warning
|
||||
|
||||
def error(self, msg, *args, **kwargs):
|
||||
"""
|
||||
Delegate an error call to the underlying logger, after adding
|
||||
|
@ -1433,12 +1435,24 @@ class LoggerAdapter(object):
|
|||
msg, kwargs = self.process(msg, kwargs)
|
||||
self.logger.log(level, msg, *args, **kwargs)
|
||||
|
||||
def setLevel(self, level):
|
||||
"""
|
||||
Set the specified level on the underlying logger.
|
||||
"""
|
||||
self.logger.setLevel(level)
|
||||
|
||||
def isEnabledFor(self, level):
|
||||
"""
|
||||
See if the underlying logger is enabled for the specified level.
|
||||
"""
|
||||
return self.logger.isEnabledFor(level)
|
||||
|
||||
def getEffectiveLevel(self):
|
||||
"""
|
||||
Get the effective level for the underlying logger.
|
||||
"""
|
||||
return self.logger.getEffectiveLevel()
|
||||
|
||||
def hasHandlers(self):
|
||||
"""
|
||||
See if the underlying logger has any handlers.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue