1
0
mirror of https://github.com/craigerl/aprsd.git synced 2025-03-23 04:44:31 -04:00

Update utils.trace

The trace call now include the filename from where the call was
made as well as the qualname for the function/method being called
so you can see from the logs what class the call is from
This commit is contained in:
Hemna 2024-11-13 21:18:08 -05:00
parent 03ce5a3d50
commit c3df974004

View File

@ -28,7 +28,8 @@ def trace(*dec_args, **dec_kwargs):
def _decorator(f):
func_name = f.__name__
func_name = f.__qualname__
func_file = "/".join(f.__code__.co_filename.split("/")[-4:])
@functools.wraps(f)
def trace_logging_wrapper(*args, **kwargs):
@ -46,10 +47,11 @@ def trace(*dec_args, **dec_kwargs):
if pass_filter:
logger.debug(
"==> %(func)s: call %(all_args)r",
"==> %(func)s: call %(all_args)r file: %(file)s",
{
"func": func_name,
"all_args": str(all_args),
"file": func_file,
},
)