X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=decorator_utils.py;h=4f98a6d4062c4fc5bfcbcac0a2fddfc00c607cf5;hb=bef486c8c06e8d743a98b89910658a615acc8bbc;hp=76faec6f7be2e8d52f3ed9c7e05e1dc6048d666b;hpb=a08ca309cb5bd7971210a9247a38c9bbe376a6e6;p=python_utils.git diff --git a/decorator_utils.py b/decorator_utils.py index 76faec6..4f98a6d 100644 --- a/decorator_utils.py +++ b/decorator_utils.py @@ -47,15 +47,11 @@ def invocation_logged(func: Callable) -> Callable: @functools.wraps(func) def wrapper_invocation_logged(*args, **kwargs): - now = datetime.datetime.now() - ts = now.strftime("%Y/%d/%b:%H:%M:%S%Z") - msg = f"[{ts}]: Entered {func.__name__}" + msg = f"Entered {func.__qualname__}" print(msg) logger.info(msg) ret = func(*args, **kwargs) - now = datetime.datetime.now() - ts = now.strftime("%Y/%d/%b:%H:%M:%S%Z") - msg = f"[{ts}]: Exited {func.__name__}" + msg = f"Exited {func.__qualname__}" print(msg) logger.info(msg) return ret @@ -297,8 +293,8 @@ def thunkify(func): exc[0] = True exc[1] = sys.exc_info() # (type, value, traceback) msg = f"Thunkify has thrown an exception (will be raised on thunk()):\n{traceback.format_exc()}" - logger.warning(msg) print(msg) + logger.warning(msg) finally: wait_event.set() @@ -435,7 +431,6 @@ def timeout( use_signals = thread_utils.is_current_thread_main_thread() def decorate(function): - if use_signals: def handler(signum, frame):