From c3df97400458d1f3c72a03d0f9ae72addad63d29 Mon Sep 17 00:00:00 2001 From: Hemna Date: Wed, 13 Nov 2024 21:18:08 -0500 Subject: [PATCH] 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 --- aprsd/utils/trace.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aprsd/utils/trace.py b/aprsd/utils/trace.py index 185d00b2..4ee827f8 100644 --- a/aprsd/utils/trace.py +++ b/aprsd/utils/trace.py @@ -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_logging_wrapper(*args, **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, }, )