mirror of
https://github.com/element-hq/synapse
synced 2024-09-11 01:55:11 +00:00
use @wraps to set the __name__ __module__ and __doc__ correctly for logged functions
This commit is contained in:
parent
c44293db2f
commit
bddc1d9fff
1 changed files with 2 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
from inspect import getcallargs
|
from inspect import getcallargs
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ def log_function(f):
|
||||||
lineno = f.func_code.co_firstlineno
|
lineno = f.func_code.co_firstlineno
|
||||||
pathname = f.func_code.co_filename
|
pathname = f.func_code.co_filename
|
||||||
|
|
||||||
|
@wraps(f)
|
||||||
def wrapped(*args, **kwargs):
|
def wrapped(*args, **kwargs):
|
||||||
name = f.__module__
|
name = f.__module__
|
||||||
logger = logging.getLogger(name)
|
logger = logging.getLogger(name)
|
||||||
|
|
Loading…
Reference in a new issue