projects
/
kiosk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Testosterone and sensitivity.
[kiosk.git]
/
decorators.py
diff --git
a/decorators.py
b/decorators.py
index 7a088796a9cce63616412a8cbfccf16c2f8bb2fa..0fbba50a3f432c4e34776126873aeedf607e0a9c 100644
(file)
--- a/
decorators.py
+++ b/
decorators.py
@@
-1,24
+1,28
@@
-from datetime import datetime
+#!/usr/bin/env python3
+
import functools
import functools
+import logging
+
+
+logger = logging.getLogger(__name__)
-def invokation_logged(func):
+
+def invocation_logged(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
@functools.wraps(func)
def wrapper(*args, **kwargs):
- now = datetime.now()
- timestamp = now.strftime("%d-%b-%Y (%H:%M:%S.%f)")
- print("%s(%s): Entered function" % (func.__name__, timestamp))
+ logger.debug(f"Entered {func.__qualname__}")
ret = func(*args, **kwargs)
ret = func(*args, **kwargs)
- now = datetime.now()
- timestamp = now.strftime("%d-%b-%Y (%H:%M:%S.%f)")
- print("%s(%s): Exited function" % (func.__name__, timestamp))
+ logger.debug(f"Exited {func.__qualname__}")
return ret
return ret
+
return wrapper
return wrapper
+
# Test
# Test
-#
@invok
ation_logged
-#def f(x):
+#
@invoc
ation_logged
+#
def f(x):
# print(x * x)
# return x * x
#
# print(x * x)
# return x * x
#
-#q = f(10)
-#print(q)
+#
q = f(10)
+#
print(q)