diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-08-20 23:54:49 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-20 23:54:49 +1000 |
commit | 324525f40ca4df19c43971ca82db0d3478114885 (patch) | |
tree | 05e6a1e45e711c9d5d18b7fbf31c79aa03fb0657 /synapse/util/logutils.py | |
parent | Merge pull request #3719 from matrix-org/erikj/use_cache_fact (diff) | |
download | synapse-324525f40ca4df19c43971ca82db0d3478114885.tar.xz |
Port over enough to get some sytests running on Python 3 (#3668)
Diffstat (limited to 'synapse/util/logutils.py')
-rw-r--r-- | synapse/util/logutils.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/util/logutils.py b/synapse/util/logutils.py index 62a00189cc..ef31458226 100644 --- a/synapse/util/logutils.py +++ b/synapse/util/logutils.py @@ -20,6 +20,8 @@ import time from functools import wraps from inspect import getcallargs +from six import PY3 + _TIME_FUNC_ID = 0 @@ -28,8 +30,12 @@ def _log_debug_as_f(f, msg, msg_args): logger = logging.getLogger(name) if logger.isEnabledFor(logging.DEBUG): - lineno = f.func_code.co_firstlineno - pathname = f.func_code.co_filename + if PY3: + lineno = f.__code__.co_firstlineno + pathname = f.__code__.co_filename + else: + lineno = f.func_code.co_firstlineno + pathname = f.func_code.co_filename record = logging.LogRecord( name=name, |