logger-plugin 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- logger_plugin-0.1.0/PKG-INFO +6 -0
- logger_plugin-0.1.0/README.md +0 -0
- logger_plugin-0.1.0/pyproject.toml +7 -0
- logger_plugin-0.1.0/setup.cfg +4 -0
- logger_plugin-0.1.0/src/__init__.py +3 -0
- logger_plugin-0.1.0/src/logger_plugin.egg-info/PKG-INFO +6 -0
- logger_plugin-0.1.0/src/logger_plugin.egg-info/SOURCES.txt +8 -0
- logger_plugin-0.1.0/src/logger_plugin.egg-info/dependency_links.txt +1 -0
- logger_plugin-0.1.0/src/logger_plugin.egg-info/top_level.txt +2 -0
- logger_plugin-0.1.0/src/main.py +31 -0
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from functools import wraps
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def log_operation():
|
|
6
|
+
|
|
7
|
+
def decorator(func):
|
|
8
|
+
|
|
9
|
+
@wraps(func)
|
|
10
|
+
def wrapper(*args, **kwargs):
|
|
11
|
+
|
|
12
|
+
start_time = time.perf_counter()
|
|
13
|
+
|
|
14
|
+
operation = func.__name__
|
|
15
|
+
|
|
16
|
+
result = func(*args, **kwargs)
|
|
17
|
+
|
|
18
|
+
elapsed_ms = (time.perf_counter() - start_time) * 1000
|
|
19
|
+
|
|
20
|
+
print({
|
|
21
|
+
"operation": operation,
|
|
22
|
+
"parameters": args,
|
|
23
|
+
"result": result,
|
|
24
|
+
"execution_time_ms": round(elapsed_ms, 3)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
return result
|
|
28
|
+
|
|
29
|
+
return wrapper
|
|
30
|
+
|
|
31
|
+
return decorator
|