Small changes to decorators.
authorScott Gasch <[email protected]>
Sun, 14 Nov 2021 23:46:39 +0000 (15:46 -0800)
committerScott Gasch <[email protected]>
Sun, 14 Nov 2021 23:46:39 +0000 (15:46 -0800)
decorator_utils.py

index e19759f92a5e5b06ea425c2a0755d96ea783a7af..4f98a6d4062c4fc5bfcbcac0a2fddfc00c607cf5 100644 (file)
@@ -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()