8000 gh-115233: Fix currentframe to get the frame of original caller by Agent-Hellboy · Pull Request #115241 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115233: Fix currentframe to get the frame of original caller #115241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
Resolve comments
  • Loading branch information
Agent-Hellboy committed Feb 11, 2024
commit 325fdaaafc9d6f4bfa337ae71a2617e3c6b44180
31 changes: 16 additions & 15 deletions Lib/logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1881,56 +1881,57 @@ def process(self, msg, kwargs):
#
# Boilerplate convenience methods
#
def debug(self, msg, *args, stacklevel=1, **kwargs):
def debug(self, msg, *args, **kwargs):
"""
Delegate a debug call to the underlying logger.
"""
self._log(DEBUG, msg, *args, stacklevel=stacklevel + 1, **kwargs)
self.log(DEBUG, msg, *args, **kwargs)

def info(self, msg, *args, stacklevel=1, **kwargs):
def info(self, msg, *args, **kwargs):
"""
Delegate an info call to the underlying logger.
"""
self._log(INFO, msg, *args, stacklevel=stacklevel + 1, **kwargs)
self.log(INFO, msg, *args, **kwargs)

def warning(self, msg, *args, stacklevel=1, **kwargs):
def warning(self, msg, *args, **kwargs):
"""
Delegate a warning call to the underlying logger.
"""
self._log(WARNING, msg, *args, stacklevel=stacklevel + 1, **kwargs)
self.log(WARNING, msg, *args, **kwargs)

def error(self, msg, *args, stacklevel=1, **kwargs):
"""
Delegate an error call to the underlying logger.
"""
self._log(ERROR, msg, *args, stacklevel=stacklevel + 1, **kwargs)
self.log(ERROR, msg, *args, **kwargs)

def exception(self, msg, *args, stacklevel=1, exc_info=True, **kwargs):
def exception(self, msg, *args,exc_info=True, **kwargs):
"""
Delegate an exception call to the underlying logger.
"""
self._log(ERROR, msg, *args, stacklevel=stacklevel + 1, exc_info=exc_info, **kwargs)
self.log(ERROR, msg, *args, exc_info=exc_info, **kwargs)

def critical(self, msg, *args, stacklevel=1, **kwargs):
def critical(self, msg, *args, **kwargs):
"""
Delegate a critical call to the underlying logger.
"""
self._log(CRITICAL, msg, *args, stacklevel=stacklevel + 1, **kwargs)
self.log(CRITICAL, msg, *args, **kwargs)

def log(self, level, msg, *args, stacklevel=1, **kwargs):
def log(self, level, msg, *args, **kwargs):
"""
Delegate a log call to the underlying logger, after adding
contextual information from this adapter instance.
"""
self._log(level, msg, *args, stacklevel=stacklevel + 1, **kwargs)
self._log(level, msg, *args, **kwargs)

def _log(self, level, msg, args, stacklevel=1, **kwargs):
def _log(self, level, msg, *args, **kwargs):
"""
Low-level log implementation, proxied to allow nested logger adapters.
"""
stacklevel = kwargs.pop('stacklevel', 1)
if self.isEnabledFor(level):
msg, kwargs = self.process(msg, kwargs)
self.logger.log(level, msg, *args, **kwargs, stacklevel=stacklevel + 3)
self.logger._log(level, msg, args, **kwargs, stacklevel=stacklevel + 3)

def isEnabledFor(self, level):
"""
Expand Down
0