Merge pull request #90 from yan12125/fix-for-python38

Fix running on Python 3.8
This commit is contained in:
依云 2018-12-27 16:29:45 +08:00 committed by GitHub
commit 22c7b5db20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -13,7 +13,7 @@ import logging
class TornadoLogFormatter(logging.Formatter):
def __init__(self, color, *args, **kwargs):
super().__init__(self, *args, **kwargs)
super().__init__(*args, **kwargs)
self._color = color
if color:
import curses

View file

@ -64,7 +64,7 @@ class _Logger(logging.Logger):
_structlog_dir = os.path.dirname(structlog.__file__)
def findCaller(self, stack_info=False):
def findCaller(self, stack_info=False, stacklevel=1):
"""
Find the stack frame of the caller so that we can note the source
file name, line number and function name.
@ -74,6 +74,12 @@ class _Logger(logging.Logger):
#IronPython isn't run with -X:Frames.
if f is not None:
f = f.f_back
orig_f = f
while f and stacklevel > 1:
f = f.f_back
stacklevel -= 1
if not f:
f = orig_f
rv = "(unknown file)", 0, "(unknown function)", None
while hasattr(f, "f_code"):
co = f.f_code